From ea81e061d22ca67869146da4667df5d5564507ba Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 9 Jun 2025 22:19:35 -0400 Subject: [PATCH 1/2] Fix null safety issues specific to HTML5 --- source/funkin/util/ReflectUtil.hx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) 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); } } From 8e7de54aa038ab360e0613584d866f8f4889d1b6 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 11 Jun 2025 05:06:45 -0400 Subject: [PATCH 2/2] Disable initial caching of "shared" assets on HTML5. --- source/funkin/InitState.hx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/funkin/InitState.hx b/source/funkin/InitState.hx index e066980b2..ab76c41f3 100644 --- a/source/funkin/InitState.hx +++ b/source/funkin/InitState.hx @@ -257,7 +257,10 @@ 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(); + #end trace('Parsing game data took: ${TimerUtil.ms(perfStart)}'); }