Skip to content

Commit

Permalink
Merge pull request #11495 from tobymao/1837-sold-out
Browse files Browse the repository at this point in the history
[Core] Prevent negative coordinates from inadvertently indexing from the end of the array
  • Loading branch information
crericha authored Jan 30, 2025
2 parents b40c9b3 + 138c40e commit 358b2e5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/engine/stock_movement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ def initialize(market)

def share_price(coordinates)
row, column = coordinates
return if row.negative? || column.negative?

@market.market[row]&.[](column)
end

Expand Down

0 comments on commit 358b2e5

Please sign in to comment.