@@ -163,16 +163,19 @@ angular.module('workspace').controller("WorkspaceController",
163163 jsonObj . objects . forEach ( function ( object ) {
164164 var sprite = object . sprite ;
165165 sprite . pictures . forEach ( function ( picture ) {
166- picture . fileurl . replace ( / \\ / gi, path . sep ) ;
167- if ( picture . fileurl && picture . fileurl . indexOf ( 'bower_components' ) === - 1 ) {
168- picture . fileurl = path . join ( '.' , picture . fileurl . substr ( picture . fileurl . lastIndexOf ( 'temp' ) ) )
166+ if ( picture . fileurl ) {
167+ picture . fileurl . replace ( / \\ / gi, path . sep ) ;
168+ if ( picture . fileurl && picture . fileurl . indexOf ( 'bower_components' ) === - 1 ) {
169+ picture . fileurl = path . join ( '.' , picture . fileurl . substr ( picture . fileurl . lastIndexOf ( 'temp' ) ) )
170+ }
169171 }
170-
171172 } ) ;
172173 sprite . sounds . forEach ( function ( sound ) {
173- sound . fileurl . replace ( / \\ / gi, path . sep ) ;
174- if ( sound . fileurl && sound . fileurl . indexOf ( 'bower_components' ) === - 1 ) {
175- sound . fileurl = path . join ( '.' , sound . fileurl . substr ( sound . fileurl . lastIndexOf ( 'temp' ) ) )
174+ if ( sound . fileurl ) {
175+ sound . fileurl . replace ( / \\ / gi, path . sep ) ;
176+ if ( sound . fileurl && sound . fileurl . indexOf ( 'bower_components' ) === - 1 ) {
177+ sound . fileurl = path . join ( '.' , sound . fileurl . substr ( sound . fileurl . lastIndexOf ( 'temp' ) ) )
178+ }
176179 }
177180 } ) ;
178181 } ) ;
@@ -498,16 +501,20 @@ angular.module('workspace').controller("WorkspaceController",
498501 jsonObj . objects . forEach ( function ( object ) {
499502 var sprite = object . sprite ;
500503 sprite . pictures . forEach ( function ( picture ) {
501- picture . fileurl . replace ( / \\ / gi, path . sep ) ;
502- if ( picture . fileurl && picture . fileurl . indexOf ( 'bower_components' ) === - 1 ) {
503- picture . fileurl = path . join ( '.' , picture . fileurl . substr ( picture . fileurl . lastIndexOf ( 'temp' ) ) )
504+ if ( picture . fileurl ) {
505+ picture . fileurl . replace ( / \\ / gi, path . sep ) ;
506+ if ( picture . fileurl && picture . fileurl . indexOf ( 'bower_components' ) === - 1 ) {
507+ picture . fileurl = path . join ( '.' , picture . fileurl . substr ( picture . fileurl . lastIndexOf ( 'temp' ) ) )
508+ }
504509 }
505510
506511 } ) ;
507512 sprite . sounds . forEach ( function ( sound ) {
508- sound . fileurl . replace ( / \\ / gi, path . sep ) ;
509- if ( sound . fileurl && sound . fileurl . indexOf ( 'bower_components' ) === - 1 ) {
510- sound . fileurl = path . join ( '.' , sound . fileurl . substr ( sound . fileurl . lastIndexOf ( 'temp' ) ) )
513+ if ( sound . fileurl ) {
514+ sound . fileurl . replace ( / \\ / gi, path . sep ) ;
515+ if ( sound . fileurl && sound . fileurl . indexOf ( 'bower_components' ) === - 1 ) {
516+ sound . fileurl = path . join ( '.' , sound . fileurl . substr ( sound . fileurl . lastIndexOf ( 'temp' ) ) )
517+ }
511518 }
512519 } ) ;
513520 } ) ;
0 commit comments