[0.9-4118-gbf9692c] Crash/bug upon total disassembly of vehicle

I was dismantling a shopping cart for transportation, but when I rem(o)ved the last frame, the game crashed. I tried to dismantle it a few more times, with similar results, until I finally succeeded. Except, when I finally managed to dismantle it, the vehicle construction UI popped up again, as if there still were parts remaining. It also showed the recently removed frame in the vehicle viewer, but when I exited the menu I could clearly confirm that it was, in fact, no longer there in vehicle form.

To summarise: Game either crashes when you remove the last part of the vehicle, or it temporarily “forgets” that you removed said part.

I have confirmed that it happens with any vehicle, even on a fresh installation.

How to reproduce the issue:

  1. Spawn in a shopping cart (or any other vehicle) from the debug menu
  2. Disassemble it. Upon removing the last part you should return to the vehicle construction screen, still showing the last part. trying to remove it again gets you a debug message.
  3. spawn in a second shopping cart.
  4. grab it and move it around for a bit.
  5. Disassemble it. Upon removing the last part the game will crash.

Thanks for the report!
A fix has been created by BevapDin and merged. More details can be found here:

As always, thanks for finding this bug. If you notice this bug is not fixed, please reply to that github link and/or this forum thread. In order to verify this bug has been fixed, compile the cataclysm source from the github page at https://github.com/CleverRaven/Cataclysm-DDA or download cataclysm from the latest experimental link links at http://en.cataclysmdda.com/ and test it.