From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by bl2.djc.id.au (Postfix, from userid 1000) id 638962CA78D; Sat, 07 Nov 2026 19:53:27 +1100 (AEDT) Date: Sat, 07 Nov 2026 19:53:29 +1100 To: sup-commits@supmua.dev Subject: [ncursesw-ruby.git] 02/06: handle NULL for ITEM name and description MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Reply-To: Dan Callaghan In-Reply-To: <179404160709.118121.923149093806097164@bl2.djc.id.au> References: <179404160709.118121.923149093806097164@bl2.djc.id.au> Thread-Index: AQAAEjRWwScN9KkGSxule9y9SuyvqA== X-Git-Host: bl2.djc.id.au X-Git-Repo: ncursesw-ruby.git X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Rev: 8c9003c9fcb0161c43df034439dba610a1495ac0 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.7.dev Auto-Submitted: auto-generated Message-Id: <20261107085327.638962CA78D@bl2.djc.id.au> From: Dan Callaghan List-Id: New commit on branch master: https://supmua.dev/git/ncursesw-ruby/commit/8c9003c9fcb0161c43df034439dba610a1495ac0.html commit 8c9003c9fcb0161c43df034439dba610a1495ac0 Author: Dan Callaghan AuthorDate: Sat Nov 7 14:45:27 2026 +1100 handle NULL for ITEM name and description --- menu_wrap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/menu_wrap.c b/menu_wrap.c index 1f934db..03b1540 100644 --- a/menu_wrap.c +++ b/menu_wrap.c @@ -781,7 +781,9 @@ static VALUE rbncurs_m_pos_menu_cursor(VALUE dummy, VALUE rb_menu) static VALUE rbncurs_c_item_name(VALUE rb_item) { ITEM *item = get_item(rb_item); - return rb_str_new2(item_name(item)); + char *str = item_name(item); + if (str == NULL) return Qnil; + return rb_str_new2(str); } static VALUE rbncurs_m_item_name(VALUE dummy, VALUE rb_item) { return rbncurs_c_item_name(rb_item); } @@ -789,7 +791,9 @@ static VALUE rbncurs_m_item_name(VALUE dummy, VALUE rb_item) static VALUE rbncurs_c_item_description(VALUE rb_item) { ITEM *item = get_item(rb_item); - return rb_str_new2(item_description(item)); + char *str = item_description(item); + if (str == NULL) return Qnil; + return rb_str_new2(str); } static VALUE rbncurs_m_item_description(VALUE dummy, VALUE rb_item) { return rbncurs_c_item_description(rb_item); }