This commit is contained in:
syuilo 2018-03-11 21:48:16 +09:00
parent ce57bb1b9b
commit e27acbb990

View file

@ -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];
}