From fd162625ee734b771232e27372d6bcef04b26ed5 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Fri, 15 Aug 2014 12:15:24 -0500 Subject: [PATCH] Improve error tolerance of new meteorite code, and record errors to log. --- core/WorldSettings.java | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/core/WorldSettings.java b/core/WorldSettings.java index 45a3fc5b3..bca4dcfde 100644 --- a/core/WorldSettings.java +++ b/core/WorldSettings.java @@ -83,14 +83,26 @@ public class WorldSettings extends Configuration try { fis = new FileInputStream( f ); - NBTTagCompound data = CompressedStreamTools.readCompressed( fis ); - fis.close(); + NBTTagCompound data = null; + + try + { + data = CompressedStreamTools.readCompressed( fis ); + } + catch (Throwable e) + { + data = new NBTTagCompound(); + AELog.error( e ); + } + + fis.close(); + return data; } catch (Throwable e) { - + AELog.error( e ); } } @@ -109,12 +121,21 @@ public class WorldSettings extends Configuration { // save FileOutputStream fos = new FileOutputStream( f ); - CompressedStreamTools.writeCompressed( data, fos ); + + try + { + CompressedStreamTools.writeCompressed( data, fos ); + } + catch( Throwable e ) + { + AELog.error( e ); + } + fos.close(); } catch (Throwable e) { - + AELog.error( e ); } }