Skip to content

fix(isar): prevent bounds crash in doesAlarmExist (#878)#879

Open
dorodb-web22 wants to merge 1 commit intoCCExtractor:mainfrom
dorodb-web22:fix-doesAlarmExist-bounds
Open

fix(isar): prevent bounds crash in doesAlarmExist (#878)#879
dorodb-web22 wants to merge 1 commit intoCCExtractor:mainfrom
dorodb-web22:fix-doesAlarmExist-bounds

Conversation

@dorodb-web22
Copy link

Description

Fixes #878

When i was reading through the DB providers and i noticed that doesAlarmExist in the Isar provider tries to grab alarms[0].alarmID to pass to a debug print before it ever checks if the list actually has anything in it.

means an existence check on an alarm ID that isn't saved in the DB yet, Isar returns an empty list, and the print line immediately crashes the app with a RangeError.

Proposed Changes

I have print block inside an if (alarms.isNotEmpty) guard now .. so it's ok to call the method on fresh/unsaved alarm IDs.

Screenshots

N/A — data layer fix.

Checklist

  • Tests have been added or updated to cover the changes
  • Documentation has been updated to reflect the changes
  • Code follows the established coding style guidelines
  • All tests are passing

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.

Bug: RangeError crash in doesAlarmExist when alarm ID doesn't exist in DB

1 participant