Skip to content

Commit

Permalink
Fix null monitors causing panics
Browse files Browse the repository at this point in the history
  • Loading branch information
zjeffer committed Jan 7, 2025
1 parent c07d326 commit 2af977c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ impl std::fmt::Display for MonitorIdentifier<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let out = match self {
MonitorIdentifier::Direction(dir) => dir.to_string(),
MonitorIdentifier::Id(id) => id.to_string(),
MonitorIdentifier::Id(id) => id.map_or("None".to_string(), |id| id.to_string()),
MonitorIdentifier::Name(name) => name.to_string(),
MonitorIdentifier::Current => "current".to_string(),
MonitorIdentifier::Relative(int) => format_relative(*int, ""),
Expand Down
2 changes: 1 addition & 1 deletion src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub type WorkspaceId = i32;

/// This type provides the id used to identify monitors
/// > its a type because it might change at some point
pub type MonitorId = i128;
pub type MonitorId = Option<i128>;

#[inline]
fn ser_spec_opt(opt: &Option<String>) -> String {
Expand Down

0 comments on commit 2af977c

Please sign in to comment.