From 14fa99515e06c90a0b2523f2cd392483cc5c741a Mon Sep 17 00:00:00 2001
From: MaxED <j.maxed@gmail.com>
Date: Wed, 20 Jul 2016 21:04:52 +0000
Subject: [PATCH] Fixed, MODELDEF parser: fixed a crash when model definition
 didn't contain the "Path" property. Fixed, MODELDEF parser: forward slash in
 Model/Skin/SurfaceSkin paths wasn't supported.

---
 Source/Core/ZDoom/ModeldefStructure.cs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Source/Core/ZDoom/ModeldefStructure.cs b/Source/Core/ZDoom/ModeldefStructure.cs
index bad406029..c824b4e55 100644
--- a/Source/Core/ZDoom/ModeldefStructure.cs
+++ b/Source/Core/ZDoom/ModeldefStructure.cs
@@ -72,6 +72,7 @@ namespace CodeImp.DoomBuilder.ZDoom
 
 		internal ModeldefStructure()
 		{
+			path = string.Empty;
 			skinnames = new string[MAX_MODELS];
 			modelnames = new string[MAX_MODELS];
 			frames = new Dictionary<string, HashSet<FrameStructure>>(StringComparer.OrdinalIgnoreCase);
@@ -156,7 +157,7 @@ namespace CodeImp.DoomBuilder.ZDoom
 						}
 
 						// GZDoom allows models with identical index, it uses the last one encountered
-						modelnames[index] = Path.Combine(path, token);
+						modelnames[index] = Path.Combine(path, token).Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
 						break;
 
 					case "skin":
@@ -201,7 +202,7 @@ namespace CodeImp.DoomBuilder.ZDoom
 						} 
 
 						// GZDoom allows skins with identical index, it uses the last one encountered
-						skinnames[skinindex] = Path.Combine(path, token);
+						skinnames[skinindex] = Path.Combine(path, token).Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
 						break;
 
 					// SurfaceSkin <int modelindex> <int surfaceindex> <string skinfile>
@@ -266,7 +267,7 @@ namespace CodeImp.DoomBuilder.ZDoom
 						} 
 
 						// Store
-						surfaceskinenames[modelindex][surfaceindex] = Path.Combine(path, token);
+						surfaceskinenames[modelindex][surfaceindex] = Path.Combine(path, token).Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
 						break;
 
 					case "scale":
-- 
GitLab