File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -294,7 +294,10 @@ export class EntropyGame extends GameBaseSimultaneous {
294294 }
295295 // valid cell
296296 try {
297- this . algebraic2coords ( from ) ;
297+ const [ fx , fy ] = this . algebraic2coords ( from ) ;
298+ if ( fx >= this . boardsize || fy >= this . boardsize ) {
299+ throw new Error ( "Coordinates out of bounds" ) ;
300+ }
298301 } catch {
299302 result . valid = false ;
300303 result . message = i18next . t ( "apgames:validation._general.INVALIDCELL" , { cell : from } ) ;
@@ -317,6 +320,9 @@ export class EntropyGame extends GameBaseSimultaneous {
317320 let xFrom : number ; let yFrom : number ;
318321 try {
319322 [ xFrom , yFrom ] = this . algebraic2coords ( from ) ;
323+ if ( xFrom >= this . boardsize || yFrom >= this . boardsize ) {
324+ throw new Error ( "Coordinates out of bounds" ) ;
325+ }
320326 } catch {
321327 result . valid = false ;
322328 result . message = i18next . t ( "apgames:validation._general.INVALIDCELL" , { cell : from } ) ;
@@ -341,6 +347,9 @@ export class EntropyGame extends GameBaseSimultaneous {
341347 let xTo : number ; let yTo : number ;
342348 try {
343349 [ xTo , yTo ] = this . algebraic2coords ( to ) ;
350+ if ( xTo >= this . boardsize || yTo >= this . boardsize ) {
351+ throw new Error ( "Coordinates out of bounds" ) ;
352+ }
344353 } catch {
345354 result . valid = false ;
346355 result . message = i18next . t ( "apgames:validation._general.INVALIDCELL" , { cell : to } ) ;
You can’t perform that action at this time.
0 commit comments