Prevent immediate crash when TextureAtlasSprite constructor throws

Fixes #79
This commit is contained in:
embeddedt 2023-05-06 11:20:54 -04:00
parent 74c2c28a66
commit 48f9ad86f0
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -118,7 +118,10 @@ public class ModernFixPlatformHooksImpl {
try {
return (TextureAtlasSprite)textureAtlasSpriteConstruct.invokeExact(atlasTexture, textureInfo, mipmapLevel, atlasWidth, atlasHeight, spriteX, spriteY, image);
} catch(Throwable e) {
throw new AssertionError("MethodHandle failed", e);
if(e instanceof RuntimeException)
throw (RuntimeException)e;
else
throw new RuntimeException("TextureAtlasSprite construction failed", e);
}
}
}