From 6570f888bae44cdc6592b4d094d44e48c6f23b25 Mon Sep 17 00:00:00 2001 From: cakepie Date: Thu, 9 Feb 2023 00:32:14 +0800 Subject: [PATCH] fix for potential nullptr --- src/avatar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/avatar.cpp b/src/avatar.cpp index 2fdf13bde1dd0..1f25d4259eac7 100644 --- a/src/avatar.cpp +++ b/src/avatar.cpp @@ -203,8 +203,9 @@ void avatar::control_npc( npc &np ) g->update_map( *this, z_level_changed ); character_mood_face( true ); + profession_id prof_id = prof ? prof->ident() : profession::generic()->ident(); get_event_bus().send( false, getID(), name, male, - prof->ident(), custom_profession ); + prof_id, custom_profession ); } void avatar::control_npc_menu()