mirror of
https://github.com/swaywm/sway.git
synced 2024-12-27 15:36:29 +01:00
swaybar: reset tokener if json is incomplete
If the tokener parses incomplete json, it sets its error value to json_tokener_continue. This means that extra json should be provided, but the code was providing the entire object again. In the interest of simplicity, the tokener is reset so that buffer_pos always points to the start of the current object.
This commit is contained in:
parent
dbda5d35eb
commit
ccdec2a329
1 changed files with 1 additions and 0 deletions
|
@ -199,6 +199,7 @@ bool i3bar_handle_readable(struct status_line *status) {
|
|||
}
|
||||
buffer_pos = status->buffer_index = 0;
|
||||
} else if (json_tokener_get_error(status->tokener) == json_tokener_continue) {
|
||||
json_tokener_reset(status->tokener);
|
||||
if (status->buffer_index < status->buffer_size) {
|
||||
// move the object to the start of the buffer
|
||||
status->buffer_index -= buffer_pos;
|
||||
|
|
Loading…
Reference in a new issue