fix(xlib): handle None return from get_wm_name() on KDE Plasma#115
Conversation
When no WM_NAME property exists on a window (common on KDE Plasma with
Fedora), window.get_wm_name() returns None. The isinstance(r, str)
check doesn't catch None, so it falls through to r.decode("latin1")
which raises AttributeError: 'NoneType' object has no attribute 'decode'.
Add a None guard that returns "unknown", matching the existing error
handling pattern in the function.
Fixes ActivityWatch#114
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 3881c92 in 25 seconds. Click for details.
- Reviewed
15lines of code in1files - Skipped
0files when reviewing. - Skipped posting
0draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
Workflow ID: wflow_ZDkAJ2plVIbxJq6b
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Greptile SummaryFixed
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 3881c92 |
|
@TimeToBuildBob Looks like a seperate PR is needed to update the actions versions |
CI Note — Pre-existing Windows FailureThe
This is a pre-existing CI infrastructure issue unrelated to this PR's changes — the repo's I'll open a separate PR to upgrade the workflow to |
Summary
Fixes #114 —
AttributeError: 'NoneType' object has no attribute 'decode'crash on Fedora KDE Plasma.Root cause:
window.get_wm_name()can returnNonewhen noWM_NAMEproperty exists on a window (common on KDE Plasma). Theisinstance(r, str)check doesn't catchNone, so it falls through tor.decode("latin1")which crashes.Fix: Add a
Noneguard that returns"unknown", matching the existing error handling pattern in the function.Changes
aw_watcher_window/xlib.py: Addedif r is None: return "unknown"check before theisinstance(r, str)branch inget_window_name()Test plan
Nonecase correctly (returns"unknown"instead of crashing)Important
Fixes
AttributeErroringet_window_name()by handlingNonereturn fromwindow.get_wm_name()inaw_watcher_window/xlib.py.AttributeErroringet_window_name()inaw_watcher_window/xlib.pyby addingif r is None: return "unknown"to handleNonereturn fromwindow.get_wm_name().This description was created by
for 3881c92. You can customize this summary. It will automatically update as commits are pushed.