Skip to content

Fix index bounds and current-quarter handling#3588

Open
Sn0w3y wants to merge 1 commit intoOpenEMS:developfrom
Sn0w3y:issues/3530
Open

Fix index bounds and current-quarter handling#3588
Sn0w3y wants to merge 1 commit intoOpenEMS:developfrom
Sn0w3y:issues/3530

Conversation

@Sn0w3y
Copy link
Collaborator

@Sn0w3y Sn0w3y commented Feb 23, 2026

Clamp endIndex to the lengths of production/consumption arrays to avoid out-of-bounds slices and change the subList check to require more than one quarter (>1) so only full future quarters are aggregated. Also add guards when reading index 0 values to handle empty arrays and null entries, defaulting to 0 for current production/consumption.

Should fix: #3530

Clamp endIndex to the lengths of production/consumption arrays to avoid out-of-bounds slices and change the subList check to require more than one quarter (>1) so only full future quarters are aggregated. Also add guards when reading index 0 values to handle empty arrays and null entries, defaulting to 0 for current production/consumption.

Should fix: OpenEMS#3530
@codecov
Copy link

codecov bot commented Feb 23, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #3588      +/-   ##
=============================================
+ Coverage      58.59%   58.60%   +0.02%     
  Complexity       105      105              
=============================================
  Files           3091     3091              
  Lines         134005   134010       +5     
  Branches        9882     9882              
=============================================
+ Hits           78508    78529      +21     
+ Misses         52590    52583       -7     
+ Partials        2907     2898       -9     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GridOptimizedCharge: Missing bounds check in calculateAvailEnergy causes IndexOutOfBoundsException

1 participant