about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-10-29 11:38:13 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-10-29 11:38:13 +0000
commit8fe09747d8f8036dfd3d13aa701bbbc5d530afce (patch)
treedfb3b5760e85298347312e3f01e89a44412a33c5
parentd18abd120358d5bc89a837b546ebab01f3a74b1e (diff)
downloadzsh-8fe09747d8f8036dfd3d13aa701bbbc5d530afce.tar.gz
zsh-8fe09747d8f8036dfd3d13aa701bbbc5d530afce.tar.xz
zsh-8fe09747d8f8036dfd3d13aa701bbbc5d530afce.zip
fix crash when colo[u]r is not available in curses
-rw-r--r--ChangeLog3
-rw-r--r--Src/Modules/curses.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 17af1c099..b32a3bfdb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-10-29  Peter Stephenson  <pws@csr.com>
 
+	* 24029: Src/Modules/curses.c: crashed on attempt to use
+	color if it wasn't available.
+
 	* unposted: configure.ac: remove some broken debugging.
 
 2007-10-28  Peter Stephenson  <p.w.stephenson@ntlworld.com>
diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c
index 063ac9014..a1801e913 100644
--- a/Src/Modules/curses.c
+++ b/Src/Modules/curses.c
@@ -268,6 +268,10 @@ zcurses_colorset(const char *nam, WINDOW *w, char *colorpair)
     short f, b;
     Colorpairnode cpn;
 
+    /* zcurses_colorpairs is only initialised if color is supported */
+    if (!zcurses_colorpairs)
+	return 1;
+
     if (zc_color_phase==1 ||
 	!(cpn = (Colorpairnode) gethashnode(zcurses_colorpairs, colorpair))) {
 	zc_color_phase = 2;