From f7d6b59aa10f646d3db458b4ad896b87f6c1d854 Mon Sep 17 00:00:00 2001 From: Justen Robertson Date: Wed, 6 May 2020 01:04:27 -0700 Subject: [PATCH] fix: segfault when siphoning a vehicle with multiple tanks (#40227) --- src/veh_interact.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/veh_interact.cpp b/src/veh_interact.cpp index 682763fc18d88..cd4f805066f0c 100644 --- a/src/veh_interact.cpp +++ b/src/veh_interact.cpp @@ -1909,7 +1909,8 @@ bool veh_interact::do_siphon( std::string &msg ) set_title( _( "Select part to siphon:" ) ); auto sel = [&]( const vehicle_part & pt ) { - return( pt.is_tank() && pt.base.contents.legacy_front().made_of( LIQUID ) ); + return( pt.is_tank() && !pt.base.contents.empty() && + pt.base.contents.only_item().made_of( LIQUID ) ); }; auto act = [&]( const vehicle_part & pt ) {