Skip to content

fix(tray): do not abort on a malformed orders entry - #5296

Open
Carltoffel wants to merge 1 commit into
Alexays:masterfrom
Carltoffel:fix/tray-orders-assert
Open

Carltoffel wants to merge 1 commit into
Alexays:masterfrom
Carltoffel:fix/tray-orders-assert

Conversation

@Carltoffel

@Carltoffel Carltoffel commented Sep 2, 2026

Copy link
Copy Markdown

What does this PR do?

Host's config parsing asserts that every value in orders is an integer:

assert(value.isInt());
orders_[key] = value.asInt();

Waybar builds with b_ndebug=false, so the assert is live in release builds
too. A single typo in a user's config takes down the whole bar with no
actionable message:

$ waybar -c bad.json
[info] Tray: No ignore-list configured
waybar: ../src/modules/sni/host.cpp:39: waybar::modules::SNI::Host::Host(...): Assertion `value.isInt()' failed.
[1]    core dumped

Reproducer:

"tray": { "orders": { "gammastep": "oops" } }

This skips the offending entry with a warning instead, and checks that orders
is an object before iterating it. User input should not be able to terminate
waybar.

After:

[warning] tray: ignoring order for 'gammastep': expected an integer

Related issues

None. Found while working on #4162 / #5297; independent of both.

Checklist

  • Code is formatted with clang-format
  • Builds locally (ninja -C build)
  • Man page updated for any new/changed user-facing option (man/) — n/a, no config surface changes
  • Tested against the affected module(s) — tray, with a valid config, a
    non-integer value, and orders set to a non-object

Host's config parsing asserted that every value in "orders" is an
integer. Waybar is built with b_ndebug=false, so the assert is live in
release builds and a single typo in the user's config aborts the whole
bar with SIGABRT and no actionable message:

  waybar: src/modules/sni/host.cpp:39: ... Assertion `value.isInt()' failed.
  [1]    core dumped

Skip the offending entry with a warning instead, and check that "orders"
is an object before iterating it. User input should never be able to
terminate waybar.
@Carltoffel
Carltoffel force-pushed the fix/tray-orders-assert branch from 87a0596 to 81d4ebd Compare September 21, 2026 08:27
@Carltoffel Carltoffel changed the title tray: do not abort on a malformed orders entry fix(tray): do not abort on a malformed orders entry Sep 21, 2026
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.

1 participant