Skip to content

Commit 40f8c34

Browse files
author
Chris Jakeman
committed
fix for illegal characters in refeerence to Shape file
1 parent e3d1d75 commit 40f8c34

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Source/RunActivity/Viewer3D/Scenery.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,16 @@ public WorldFile(Viewer viewer, int tileX, int tileZ, bool visible)
332332
var shapeFilePath = fileNameIsNotShape || String.IsNullOrEmpty(worldObject.FileName) ? null : global ? viewer.Simulator.BasePath + @"\Global\Shapes\" + worldObject.FileName : viewer.Simulator.RoutePath + @"\Shapes\" + worldObject.FileName;
333333
if (shapeFilePath != null)
334334
{
335-
shapeFilePath = Path.GetFullPath(shapeFilePath);
335+
try
336+
{
337+
shapeFilePath = Path.GetFullPath(shapeFilePath);
338+
}
339+
catch (Exception e)
340+
{
341+
Trace.TraceWarning("Invalid reference in World file {0} to scenery file {1} for {2}: {3}", WFilePath, shapeFilePath, worldObject.FileName, e.Message);
342+
Trace.TraceInformation("Illegal characters in a file path are: \\ / : * ? \" < > |");
343+
shapeFilePath = null;
344+
}
336345
if (!File.Exists(shapeFilePath))
337346
{
338347
Trace.TraceWarning("{0} scenery object {1} with StaticFlags {3:X8} references non-existent {2}", WFileName, worldObject.UID, shapeFilePath, worldObject.StaticFlags);

0 commit comments

Comments
 (0)