SteamWar/BauSystem2.0
Archiviert
12
0

Hotfix NPE in StorageLib
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-07-30 12:08:47 +02:00
Ursprung bae39e2921
Commit 13ec64a4fa

Datei anzeigen

@ -49,7 +49,7 @@ public class StorageLib implements LuaLib {
global.set("get", new OneArgFunction() {
@Override
public LuaValue call(LuaValue arg) {
return GLOBAL_STORAGE.get(arg.checkjstring());
return GLOBAL_STORAGE.getOrDefault(arg.checkjstring(), NIL);
}
});
global.set("set", new TwoArgFunction() {
@ -58,7 +58,6 @@ public class StorageLib implements LuaLib {
return GLOBAL_STORAGE.put(arg1.checkjstring(), arg2);
}
});
storageLib.set("global", global);
LuaTable playerStorage = new LuaTable();
@ -66,7 +65,7 @@ public class StorageLib implements LuaLib {
playerStorage.set("get", new OneArgFunction() {
@Override
public LuaValue call(LuaValue arg) {
return playerStorageMap.get(arg.checkjstring());
return playerStorageMap.getOrDefault(arg.checkjstring(), NIL);
}
});
playerStorage.set("set", new TwoArgFunction() {
@ -82,7 +81,7 @@ public class StorageLib implements LuaLib {
regionStorage.set("get", new OneArgFunction() {
@Override
public LuaValue call(LuaValue arg) {
return regionStorageMap.get(arg.checkjstring());
return regionStorageMap.getOrDefault(arg.checkjstring(), NIL);
}
});
regionStorage.set("set", new TwoArgFunction() {