From e27acbb99038a535b440436b3d46197a6db1c4bd Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 11 Mar 2018 21:48:16 +0900 Subject: [PATCH] :v: --- src/common/othello/core.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/othello/core.ts b/src/common/othello/core.ts index 848cf486e..39ceb921a 100644 --- a/src/common/othello/core.ts +++ b/src/common/othello/core.ts @@ -166,7 +166,8 @@ export default class Othello { * @param pos 位置 */ public mapDataGet(pos: number): MapPixel { - if (pos < 0 || pos >= this.map.length) return 'null'; + const [x, y] = this.transformPosToXy(pos); + if (x < 0 || y < 0 || x >= this.mapWidth || y >= this.mapHeight) return 'null'; return this.map[pos]; }