From b5d7d8452e3f79e7aca2e9e195c7a734d9d8bcd8 Mon Sep 17 00:00:00 2001 From: RenechCDDA <84619419+RenechCDDA@users.noreply.github.com> Date: Sat, 6 Apr 2024 08:21:07 -0400 Subject: [PATCH] No mandatory member --- src/npctalk.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/npctalk.cpp b/src/npctalk.cpp index cbabb92fdf23e..d7ca41245c45b 100644 --- a/src/npctalk.cpp +++ b/src/npctalk.cpp @@ -183,7 +183,9 @@ struct item_search_data { id = itype_id( jo.get_string( "id", "" ) ); category = item_category_id( jo.get_string( "category", "" ) ); material = material_id( jo.get_string( "material", "" ) ); - calories = jo.get_int( "calories" ); + if( jo.has_int( "calories" ) ) { + calories = jo.get_int( "calories" ); + } for( std::string flag : jo.get_string_array( "flags" ) ) { flags.emplace_back( flag ); }