diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-06-23 01:35:38 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2023-06-23 01:46:37 +0200 |
commit | 1d1634b95ac3d29d3e44820f01bc789944366147 (patch) | |
tree | fb24e9740fdc540ca1937aea4461cbec85d3d185 | |
parent | 7310fe88d6fbf94d1bda7c10f24fa9e396d80311 (diff) | |
download | wee-slack-1d1634b95ac3d29d3e44820f01bc789944366147.tar.gz |
Return from modify_buffer_line if the line isn't found
If the line isn't found, line_pointer becomes an empty string which will
crash WeeChat when it's used with hdata_update. This happened when the
history for a channel that contained a reply also posted to the channel
was loaded, because in that case wee-slack tries to modify the parent
message before the channel history is printed, so it couldn't find the
line.
-rw-r--r-- | wee_slack.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py index 3d11a06..6dae8af 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -4967,6 +4967,9 @@ def modify_buffer_line(buffer_pointer, ts, new_text): is_last_line = False line_pointer = w.hdata_move(hdata.line, line_pointer, -1) + if not line_pointer: + return w.WEECHAT_RC_OK + if weechat_version >= 0x04000000: data = w.hdata_pointer(hdata.line, line_pointer, "data") w.hdata_update(hdata.line_data, data, {"message": new_text}) |