@@ -277,17 +277,23 @@ public class PoseableShape : StaticShape
277
277
public PoseableShape ( Viewer viewer , string path , WorldPosition initialPosition , ShapeFlags flags )
278
278
: base ( viewer , path , initialPosition , flags )
279
279
{
280
- // In some cases, a corrupt shape file can prevent matrices from loading
281
280
if ( SharedShape . Matrices . Length > 0 )
282
281
{
283
282
XNAMatrices = new Matrix [ SharedShape . Matrices . Length ] ;
284
283
for ( int iMatrix = 0 ; iMatrix < SharedShape . Matrices . Length ; ++ iMatrix )
285
284
XNAMatrices [ iMatrix ] = SharedShape . Matrices [ iMatrix ] ;
286
285
}
287
- else
286
+ else // If the shape file is missing or fails to load, we need some default data to prevent crashes
288
287
{
289
- Trace . TraceWarning ( "Could not determine matrices for shape file {0} file may be corrupt" , SharedShape . FilePath ) ;
290
- // The 0th matrix should always be the identity matrix, add this to avoid crashes elsewhere
288
+ if ( path != null && path != "Empty" )
289
+ {
290
+ string location = path ;
291
+ if ( path != null && path . Contains ( '\0 ' ) )
292
+ location = path . Split ( '\0 ' ) [ 0 ] ;
293
+
294
+ Trace . TraceWarning ( "Couldn't load shape {0} file may be corrupt" , location ) ;
295
+ }
296
+ // The 0th matrix should always be the identity matrix
291
297
XNAMatrices = new Matrix [ 1 ] ;
292
298
XNAMatrices [ 0 ] = Matrix . Identity ;
293
299
}
0 commit comments