diff --git a/source/funkin/InitState.hx b/source/funkin/InitState.hx index 7a1a23c41..9334a413a 100644 --- a/source/funkin/InitState.hx +++ b/source/funkin/InitState.hx @@ -255,6 +255,8 @@ class InitState extends FlxState funkin.input.Cursor.hide(); + #if !html5 + // This fucking breaks on HTML5 builds because the "shared" library isn't loaded yet. funkin.FunkinMemory.initialCache(); } diff --git a/source/funkin/util/ReflectUtil.hx b/source/funkin/util/ReflectUtil.hx index 31426f9d4..fecd33c32 100644 --- a/source/funkin/util/ReflectUtil.hx +++ b/source/funkin/util/ReflectUtil.hx @@ -7,6 +7,7 @@ import Type.ValueType; * Used for sandboxing in scripts. */ @:nullSafety +@SuppressWarnings("checkstyle:VarTypeHint") class ReflectUtil { /** @@ -360,7 +361,11 @@ class ReflectUtil */ public static function getClassFieldsOf(obj:Any):Array { - return Type.getClassFields(Type.getClass(obj)); + if (obj == null) return []; + @:nullSafety(Off) + var cls = Type.getClass(obj); + if (cls == null) return []; + return Type.getClassFields(cls); } /** @@ -380,7 +385,11 @@ class ReflectUtil */ public static function getInstanceFieldsOf(obj:Any):Array { - return Type.getInstanceFields(Type.getClass(obj)); + if (obj == null) return []; + @:nullSafety(Off) + var cls = Type.getClass(obj); + if (cls == null) return []; + return Type.getInstanceFields(cls); } /** @@ -396,10 +405,14 @@ class ReflectUtil /** * Get the string name of the class of the given object. * @param obj The object to query. - * @return The name of the given class. + * @return The name of the given class, or `Unknown` if the class couldn't be determined. */ public static function getClassNameOf(obj:Any):String { - return Type.getClassName(Type.getClass(obj)); + if (obj == null) return "Unknown"; + @:nullSafety(Off) + var cls = Type.getClass(obj); + if (cls == null) return "Unknown"; + return Type.getClassName(cls); } }