diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-03-11 21:48:16 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-03-11 21:48:16 +0900 |
| commit | 0ef226188963ec031a1fec970cdfd740b33c7d30 (patch) | |
| tree | af21a772a2666e3bf3de5105529a78eebb877f14 /src/common | |
| parent | v4111 (diff) | |
| download | sharkey-0ef226188963ec031a1fec970cdfd740b33c7d30.tar.gz sharkey-0ef226188963ec031a1fec970cdfd740b33c7d30.tar.bz2 sharkey-0ef226188963ec031a1fec970cdfd740b33c7d30.zip | |
:v:
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/othello/core.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/othello/core.ts b/src/common/othello/core.ts index 848cf486e7..39ceb921a9 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]; } |