Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: hash completion bug?



Hiroki Tamakoshi wrote:

> % zsh -f
> % typeset -A foo
> % foo[TAB
> cause segmentation fault.

Urgh. compctl.

Better test if there is already a hashtable before trying to use it.

Bye
 Sven

Index: Src/Zle/compctl.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compctl.c,v
retrieving revision 1.7
diff -u -r1.7 compctl.c
--- Src/Zle/compctl.c	2000/06/22 08:42:37	1.7
+++ Src/Zle/compctl.c	2001/01/16 12:37:05
@@ -3749,7 +3749,10 @@
 	dumphashtable(aliastab, t | (cc->mask & (CC_DISCMDS|CC_EXCMDS)));
     if (keypm && cc == &cc_dummy) {
 	/* Add the keys of the parameter in keypm. */
-	scanhashtable(keypm->gets.hfn(keypm), 0, 0, PM_UNSET, addhnmatch, 0);
+	HashTable t = keypm->gets.hfn(keypm);
+
+	if (t)
+	    scanhashtable(t, 0, 0, PM_UNSET, addhnmatch, 0);
 	keypm = NULL;
 	cc_dummy.suffix = NULL;
     }

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author