Skip to content

Commit

Permalink
[Core] Prevent negative coordinates from inadvertantly indexing from …
Browse files Browse the repository at this point in the history
…the end of the array
  • Loading branch information
crericha committed Jan 30, 2025
1 parent c90c43d commit 138c40e
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 138c40e

Please sign in to comment.