mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 12:22:35 +00:00
ModelReader: fixed a crash when trying to load a model without extension.
This commit is contained in:
parent
e5a9bac2ad
commit
3a4876704a
3 changed files with 10 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
namespace CodeImp.DoomBuilder.GZBuilder.Data {
|
||||
public struct TextureData {
|
||||
public const string INVALID_TEXTURE = "**INVALID_TEXTURE**";
|
||||
public const string INVALID_TEXTURE = "**invalid_texture**";
|
||||
public static string[] SUPPORTED_TEXTURE_EXTENSIONS = { ".jpg", ".tga", ".png", ".dds", ".pcx" };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,10 +67,14 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
|
|||
break;
|
||||
} else {
|
||||
//check extension
|
||||
int dotPos = token.LastIndexOf(".");
|
||||
string fileExt = token.Substring(token.LastIndexOf("."), token.Length - dotPos);
|
||||
if (fileExt != ".md3" && fileExt != ".md2") {
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Error in " + parser.Source + " at line " + parser.GetCurrentLineNumber() + ": model '" + token + "' not parsed. Only MD3 and MD2 models are supported.");
|
||||
string fileExt = Path.GetExtension(token);
|
||||
if (string.IsNullOrEmpty(fileExt)){
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Error in " + parser.Source + " at line " + parser.GetCurrentLineNumber() + ": model '" + token + "' won't be loaded. Models without extension are not supported by GZDoom.");
|
||||
gotErrors = true;
|
||||
break;
|
||||
}
|
||||
if(fileExt != ".md3" && fileExt != ".md2") {
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Error in " + parser.Source + " at line " + parser.GetCurrentLineNumber() + ": model '" + token + "' won't be loaded. Only MD2 and MD3 models are supported.");
|
||||
gotErrors = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
|
|||
//report errors
|
||||
if(errors.Count > 0) {
|
||||
foreach(string e in errors)
|
||||
General.ErrorLogger.Add(ErrorType.Error, "ModelLoader: error while loading '" + mde.ModelNames[i] + "':" + e);
|
||||
General.ErrorLogger.Add(ErrorType.Error, "ModelLoader: error while loading '" + mde.ModelNames[i] + "': " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue