CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.53k stars 4.16k forks source link

Removing a “survivor headlamp (on)” from a follower through the “r Sort armor” menu causes a crash/segmentation fault. EDIT: there's the 0F temperature bug as well. #42503

Closed Nhatorama closed 4 years ago

Nhatorama commented 4 years ago

Describe the bug

Removing a “survivor headlamp (on)” from a follower through the “r Sort armor” menu causes a crash/segmentation fault.

Steps To Reproduce

  1. Wake or don’t wake the follower.
  2. Move into the follower.
  3. Choose “r Sort armor”
  4. Select the “survivor headlamp (on)”
  5. Press u
  6. Press y

Expected behavior

The game should not crash when removing a followers’ worn items.

Versions and configuration

Additional context

Debug and crash logs cataclysm-dda.zip Save file Alta Vista.zip this is "a save file that occurs in the right conditions, just before the crash happens." To take off the “survivor headlamp (on)” from the follower without causing a crash you need to remove everything else before removing the survivor headlamp. Alas trying to remove the military rucksuck that contains the "survivor headlamp (on)” also causes a crash.

andrei8l commented 4 years ago
index 0c3b77a318..eb64c4ff56 100644
--- a/src/armor_layers.cpp
+++ b/src/armor_layers.cpp
@@ -878,6 +878,7 @@ void player::sort_armor()
                     }
                     player_character.cancel_activity();
                     selected = -1;
+                    leftListIndex = std::max( 0, leftListIndex - 1 );
                 }
             }
         } else if( action == "ASSIGN_INVLETS" ) {

I don't think I'll PR this one