From a6ff92db52582a15ea88fa55b212f8be106487e5 Mon Sep 17 00:00:00 2001 From: ipcyborg Date: Thu, 22 Aug 2019 18:08:20 +0300 Subject: [PATCH] Added check for null: fixed compilation with gcc 7.4. --- src/game.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 1520882e25cb0..39f4feb40f8d9 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -11678,8 +11678,9 @@ void game::add_artifact_dreams( ) for( auto &it : art_items ) { //Pick only the ones with an applicable dream auto art = it->type->artifact; - if( art->charge_req != ACR_NULL && ( it->ammo_remaining() < it->ammo_capacity() || - it->ammo_capacity() == 0 ) ) { //or max 0 in case of wacky mod shenanigans + if( art.has_value() && art->charge_req != ACR_NULL && + ( it->ammo_remaining() < it->ammo_capacity() || + it->ammo_capacity() == 0 ) ) { //or max 0 in case of wacky mod shenanigans add_msg( m_debug, "Checking artifact %s", it->tname() ); if( check_art_charge_req( *it ) ) { add_msg( m_debug, " Has freq %s,%s", art->dream_freq_met, art->dream_freq_unmet );