瀏覽代碼

Fix crash when using LOD without any instance of LocalFileSystem

TothBenoit 1 年之前
父節點
當前提交
2f9fe24efe
共有 1 個文件被更改,包括 2 次插入0 次删除
  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");