alixinne / hyperion.rs

Rust implementation of the Hyperion Ambient Lighting software
MIT License
10 stars 1 forks source link

Fix: Loading hyperion.db panic if table is not found or contains unexpected values #4

Closed tuxuser closed 2 years ago

tuxuser commented 2 years ago

Currently the config parser in backend/db unwraps the result of getting a particular config instance and fails hard/panics if not found.

Error:

The application panicked (crashed).
Message:  called `Option::unwrap()` on a `None` value
Location: src/models/backend/db.rs:58

DB in question: hyperion_db.zip

Thise change ensures safer handling via matching against Some/None.

alixinne commented 2 years ago

Thanks for the PR, good catch! I just ran cargo fmt and slightly reworded your commit before merging.