summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2021-08-12 08:10:20 +0000
committernicm <nicm>2021-08-12 08:10:20 +0000
commit26773ea9efd3b555833618719446309cf7a024de (patch)
tree1e0db1852415c57cf7a542253bfcdb38c98479b9
parent163908fe8a0af8cf2d24510415bd4f81ace3a4d1 (diff)
Do not dereference pane when it is NULL, fixes a crash when creating a
hook from the config, GitHub issue 2820.
-rw-r--r--format.c2
-rw-r--r--notify.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/format.c b/format.c
index b5f09649..5a295198 100644
--- a/format.c
+++ b/format.c
@@ -3098,7 +3098,7 @@ format_log_debug_cb(const char *key, const char *value, void *arg)
void
format_log_debug(struct format_tree *ft, const char *prefix)
{
- format_each(ft, format_log_debug_cb, prefix);
+ format_each(ft, format_log_debug_cb, (void *)prefix);
}
/* Walk each format. */
diff --git a/notify.c b/notify.c
index 8b2610c2..2510a394 100644
--- a/notify.c
+++ b/notify.c
@@ -200,7 +200,7 @@ notify_hook(struct cmdq_item *item, const char *name)
ne.client = cmdq_get_client(item);
ne.session = target->s;
ne.window = target->w;
- ne.pane = target->wp->id;
+ ne.pane = (target->wp != NULL ? target->wp->id : -1);
ne.formats = format_create(NULL, NULL, 0, FORMAT_NOJOBS);
format_add(ne.formats, "hook", "%s", name);