sup

A curses threads-with-tags style email client

ncursesw-ruby.git

git clone https://supmua.dev/git/ncursesw-ruby/
commit b8132587a1c0649b49fdbb597a4d98b44741d46d
parent de9655299718f45ea3e295512846bc8eb041c4e8
Author: Dan Callaghan <djc@djc.id.au>
Date:   Mon,  5 Oct 2026 19:51:03 +1100

fix segfault when tigetstr() returns -1

Diffstat:
M ncurses_wrap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ncurses_wrap.c b/ncurses_wrap.c
@@ -1495,7 +1495,9 @@ static VALUE rbncurs_tigetnum(VALUE dummy, VALUE arg1) {
 #endif
 #ifdef HAVE_TIGETSTR
 static VALUE rbncurs_tigetstr(VALUE dummy, VALUE arg1) {
-    return rb_str_new2(tigetstr(STR2CSTR(arg1)));
+    char * str = tigetstr(STR2CSTR(arg1));
+    if (str == NULL || str == (char *)-1) return Qnil;
+    return rb_str_new2(str);
 }
 #endif
 static VALUE rbncurs_timeout(VALUE dummy, VALUE arg1) {