cache: prevent dumping enums with no data

This commit is contained in:
Joshua Filby
2018-11-14 20:09:26 -06:00
committed by Max Weber
parent f65a0c2268
commit 18ec864250
2 changed files with 10 additions and 2 deletions

View File

@@ -36,6 +36,11 @@ public class EnumLoader
public EnumDefinition load(int id, byte[] b)
{
if (b.length == 1 && b[0] == 0)
{
return null;
}
EnumDefinition def = new EnumDefinition();
InputStream is = new InputStream(b);

View File

@@ -78,8 +78,11 @@ public class EnumDumperTest
EnumDefinition def = loader.load(file.getFileId(), b);
Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset());
++count;
if (def != null)
{
Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset());
++count;
}
}
}