diff --git a/src/main/java/com/msb/model/GameModel.java b/src/main/java/com/msb/model/GameModel.java index ae11f28..5c33e0c 100644 --- a/src/main/java/com/msb/model/GameModel.java +++ b/src/main/java/com/msb/model/GameModel.java @@ -138,10 +138,12 @@ public class GameModel { } catch (IOException e) { e.printStackTrace(); } finally { - try { - oos.close(); - } catch (IOException e) { - e.printStackTrace(); + if(null != oos) { + try { + oos.close(); + } catch (IOException e) { + e.printStackTrace(); + } } } } @@ -156,13 +158,14 @@ public class GameModel { } catch (IOException | ClassNotFoundException e) { e.printStackTrace(); } finally { - try { - ois.close(); - } catch (IOException e) { - e.printStackTrace(); + if(null != ois) { + try { + ois.close(); + } catch (IOException e) { + e.printStackTrace(); + } } } - } }