diff --git a/.gitignore b/.gitignore index 6786ad1..6037497 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,5 @@ hs_err_pid* *.iml *.ipr *.iws -.idea/ \ No newline at end of file +.idea/ +/out \ No newline at end of file diff --git a/build.gradle b/build.gradle index 92a7421..50fdc63 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.0.7.4" +version = "1.7.10-1.0.7.4QF" group= "makeo.gadomancy" archivesBaseName = "gadomancy" diff --git a/src/main/java/makeo/gadomancy/common/data/config/ModData.java b/src/main/java/makeo/gadomancy/common/data/config/ModData.java index 674234b..6e0f9e3 100644 --- a/src/main/java/makeo/gadomancy/common/data/config/ModData.java +++ b/src/main/java/makeo/gadomancy/common/data/config/ModData.java @@ -24,6 +24,7 @@ import java.util.Map; * for more read the LICENSE file * * Created by makeo @ 26.07.2015 18:15 + * Modified by bartimaeusnek @ 31.12.2018, 19:00 GMT+1 */ public class ModData { private static final Gson GSON = new Gson(); @@ -77,7 +78,7 @@ public class ModData { } public boolean load() { - if(file.exists()) { + if(file != null && file.exists()) { ObjectInputStream inOBJ = null; FileInputStream in = null; try { @@ -87,18 +88,21 @@ public class ModData { } catch (IOException | ClassCastException | JsonSyntaxException | ClassNotFoundException e) { // e.printStackTrace(); try { - inOBJ.close(); - in.close(); + if (inOBJ != null) + inOBJ.close(); + if (in != null) + in.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } return false; } finally { - if(in != null) try { - inOBJ.close(); - in.close(); + if (inOBJ != null) + inOBJ.close(); + if (in != null) + in.close(); } catch (IOException ignored) { } } } @@ -123,17 +127,20 @@ public class ModData { } catch (JsonIOException | IOException e) { e.printStackTrace(); try { - outOBJ.close(); - out.close(); + if (outOBJ != null) + outOBJ.close(); + if(out != null) + out.close(); } catch (IOException e1) { e1.printStackTrace(); } return false; } finally { - if(out != null) try { - outOBJ.close(); - out.close(); + if(outOBJ != null) + outOBJ.close(); + if(out != null) + out.close(); } catch (IOException ignored) { } } return true;