Browse Source

Fix crash when using LOD without any instance of LocalFileSystem

TothBenoit 1 year ago
parent
commit
2f9fe24efe
1 changed files with 2 additions and 0 deletions
  1. 2 0
      h3d/prim/ModelDatabase.hx

+ 2 - 0
h3d/prim/ModelDatabase.hx

@@ -93,6 +93,8 @@ class ModelDatabase {
 
 	public function getDefaultLodConfig( dir : String ) : Array<Float> {
 		var fs = Std.downcast(hxd.res.Loader.currentInstance.fs, hxd.fs.LocalFileSystem);
+		if (fs == null)
+			return baseLodConfig;
 		var c = @:privateAccess fs.convert.getConfig(defaultLodConfigs, baseLodConfig, dir, function(fullObj) {
 			if (Reflect.hasField(fullObj, "lods.screenRatio"))
 				return Reflect.field(fullObj, "lods.screenRatio");