summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/query/map_update.erl')
-rw-r--r--src/map/query/map_update.erl18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/map/query/map_update.erl b/src/map/query/map_update.erl
index ffdb37b..fbe9203 100644
--- a/src/map/query/map_update.erl
+++ b/src/map/query/map_update.erl
@@ -46,9 +46,21 @@ parse_input (Query) ->
EncodedMapContent = maps:get(<<"t">>, JSONReqMap),
%% TODO [LOW]: those checks should be done while queries are locked.
- true = (MapWidth > 0),
- true = (MapHeight > 0),
- true = (length(EncodedMapContent) == (MapWidth * MapHeight)),
+ if
+ (MapWidth =< 0) -> error({map, width, MapWidth});
+ (MapHeight =< 0) -> error({map, height, MapHeight});
+ (length(EncodedMapContent) =/= (MapWidth * MapHeight)) ->
+ error
+ (
+ {
+ map,
+ content_size,
+ (MapWidth * MapHeight),
+ length(EncodedMapContent)
+ }
+ );
+ true -> ok
+ end,
MapContent = lists:map(fun shr_tile_instance:decode/1, EncodedMapContent),