Skip to content

Commit

Permalink
Rework dmi_read_states to just return null instead of erroring
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy committed Nov 11, 2024
1 parent 442985c commit 4370454
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/dmi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ pub fn dmi_resize_png(
}

#[byond_fn]
pub fn dmi_read_states(path: PathBuf) -> ByondResult<Vec<String>> {
pub fn dmi_read_states(path: PathBuf) -> Option<Vec<String>> {
let icon = File::open(path)
.map(BufReader::new)
.map_err(ByondError::boxed)
.and_then(|reader| Dmi::load(reader).map_err(ByondError::boxed))?;
Ok(icon.states.into_iter().map(|state| state.name).collect())
.ok()
.and_then(|reader| Dmi::load(reader).ok())?;
Some(icon.states.into_iter().map(|state| state.name).collect())
}

0 comments on commit 4370454

Please sign in to comment.