ActivityWatch / aw-watcher-window

Cross-platform window watcher (for use with ActivityWatch)
Mozilla Public License 2.0
91 stars 53 forks source link

check out for bytes instead of string when window title fails to decode #23

Closed nikanar closed 7 years ago

nikanar commented 7 years ago

https://github.com/ActivityWatch/aw-watcher-window/issues/21

we need a check to avoid the .encode('utf8') if d.value is a bytes object.

I'm not sure if d.value can not be a bytes object at that point, after a failed decode() (so whether the else branch ever gets visited), I only trust the writer of the former version who tried to d.value.encode(), from which I deduce that at it is possible sometimes (therefore, sometimes d.value is not bytes).

ErikBjare commented 7 years ago

Looks good to me, merging. Thanks @nikanar!