about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2024-02-04 16:25:14 +0100
committerMikael Magnusson <mikachu@gmail.com>2024-02-04 16:48:02 +0100
commitec446a6f349c3f0a31ccd4cd21a257555bf53382 (patch)
treebcfe0fcedc150d7f303ba418a20685a26a442303
parentc8f0946ddc428ff2d44e304d188b238c20c56484 (diff)
downloadzsh-ec446a6f349c3f0a31ccd4cd21a257555bf53382.tar.gz
zsh-ec446a6f349c3f0a31ccd4cd21a257555bf53382.tar.xz
zsh-ec446a6f349c3f0a31ccd4cd21a257555bf53382.zip
52516: fix crash in %H when hlgroups is empty
typeset -A .zle.hlgroups; print -P %H
-rw-r--r--ChangeLog4
-rw-r--r--Src/prompt.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f059baa1..1804037f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2024-02-04  Mikael Magnusson  <mikachu@gmail.com>
+
+	* 52516: Src/prompt.c: fix crash in %H when hlgroups is empty
+
 2024-02-03  Bart Schaefer  <schaefer@zsh.org>
 
 	* unposted: Util/printdefines: updates and fix omissions
diff --git a/Src/prompt.c b/Src/prompt.c
index ec79067cd..b1e5041bd 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -257,7 +257,7 @@ parsehighlight(char *arg, char endchar, zattr *atr)
     {
 	Param node;
 	HashTable ht = v->pm->gsu.h->getfn(v->pm);
-	if ((node = (Param) ht->getnode(ht, arg))) {
+	if (ht && (node = (Param) ht->getnode(ht, arg))) {
 	    attrs = node->gsu.s->getfn(node);
 	    entered = 1;
 	    if (match_highlight(attrs, atr, 0) == attrs)