aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2016-05-09 14:28:51 +0200
committerPacien TRAN-GIRARD2016-05-09 14:28:51 +0200
commit68a71bf1ac4359e584ac36cc33e2d37d323563a6 (patch)
treead7ee2d376053c0ac6ea3c5a20b5cdba859402dc
parent10a9bc4bc745b49b2739d0e98eb8ad799fb8753e (diff)
downloadxblast-68a71bf1ac4359e584ac36cc33e2d37d323563a6.tar.gz
Validate explosions length
-rw-r--r--src/ch/epfl/xblast/client/GameStateDeserializer.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ch/epfl/xblast/client/GameStateDeserializer.java b/src/ch/epfl/xblast/client/GameStateDeserializer.java
index e2039ed..8b203b1 100644
--- a/src/ch/epfl/xblast/client/GameStateDeserializer.java
+++ b/src/ch/epfl/xblast/client/GameStateDeserializer.java
@@ -141,9 +141,15 @@ public final class GameStateDeserializer {
141 * 141 *
142 * @param serializedExplosions the run-length-compressed, serialized explosions 142 * @param serializedExplosions the run-length-compressed, serialized explosions
143 * @return the explosions 143 * @return the explosions
144 * @throws IllegalArgumentException if the length of the serialized explosions is invalid
144 */ 145 */
145 private static List<Image> deserializeExplosions(List<Byte> serializedExplosions) { 146 private static List<Image> deserializeExplosions(List<Byte> serializedExplosions) {
146 return deserializeImageChunk(serializedExplosions, ImageCollection.EXPLOSIONS_IMAGES); 147 List<Image> explosions = deserializeImageChunk(serializedExplosions, ImageCollection.EXPLOSIONS_IMAGES);
148
149 if (explosions.size() != Cell.ROW_MAJOR_ORDER.size())
150 throw new IllegalArgumentException();
151
152 return explosions;
147 } 153 }
148 154
149 /** 155 /**