Skip to content

Commit

Permalink
Merge pull request #70937 from Ramza13/fix-pathfinding-crash
Browse files Browse the repository at this point in the history
Fix pathfinding segfault
  • Loading branch information
akrieger authored Jan 14, 2024
2 parents 46f8117 + 46daa56 commit 1f15f20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pathfinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ std::vector<tripoint> map::route( const tripoint &f, const tripoint &t,
int dummy = -1;
const bool is_outside_veh = veh_at_internal( cur, dummy ) != veh;

if( doors && veh->next_part_to_open( part, is_outside_veh ) != -1 ) {
if( doors && part != -1 && veh->next_part_to_open( part, is_outside_veh ) != -1 ) {
// Handle car doors, but don't try to path through curtains
newg += 10; // One turn to open, 4 to move there
} else if( locks && veh->next_part_to_unlock( part, is_outside_veh ) != -1 ) {
Expand Down

0 comments on commit 1f15f20

Please sign in to comment.