You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a config file is empty for whatever reason and deserialized using the GsonConfigSerializer, it'll return null, which will NPE inside ConfigManager.load()here.
I thought of registering a load listener to work around that, but since load() is called from ConfigManager's constructor, it is impossible to call registerLoadListener() before load() - which is arguably another issue.
I think a good fix would be to let GsonConfigSerializerthrow a SerializationException return createDefault() when Gson returns a null value here, so it automatically resets and re-saves the config.
Encountered in RandomMcSomethin/fallingleaves#64
When a config file is empty for whatever reason and deserialized using the
GsonConfigSerializer
, it'll returnnull
, which will NPE insideConfigManager.load()
here.I thought of registering a load listener to work around that, but since
load()
is called fromConfigManager
's constructor, it is impossible to callregisterLoadListener()
beforeload()
- which is arguably another issue.I think a good fix would be to let
GsonConfigSerializer
throw areturnSerializationException
createDefault()
whenGson
returns anull
value here, so it automatically resets and re-saves the config.Relevant quote from the Gson javadoc:
The text was updated successfully, but these errors were encountered: