cxong / cdogs-sdl

Classic overhead run-and-gun game
https://cxong.github.io/cdogs-sdl/
GNU General Public License v2.0
891 stars 114 forks source link

Editor crashes on attempt to delete mission from empty campaign #313

Closed Wuzzy2 closed 9 years ago

Wuzzy2 commented 9 years ago

When it is attempted to delete a mission from a campaign without any missions, the editor crashes.

This is how this stunt is done:

  1. Start editor
  2. Press [Delete] on your keyboard

This is one possible way. You may also load a dummy campaign with some missions, then delete all missions with the [Delete] key. When there is no mission left, press [Delete] once again and: BAM! It crashes with the same error:

cdogs-sdl-editor: /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogsed/editor_ui_common.c:69: DeleteMission: Assertion `co->MissionIndex < (int)co->Setting.Missions.size' failed.

Backtrace from the GNU Debugger:

#0  0xffffe424 in __kernel_vsyscall ()
#1  0xb7cc9297 in raise () from /usr/lib/libc.so.6
#2  0xb7cca8ea in abort () from /usr/lib/libc.so.6
#3  0xb7cc22f7 in __assert_fail_base () from /usr/lib/libc.so.6
#4  0xb7cc237b in __assert_fail () from /usr/lib/libc.so.6
#5  0x0805f32b in DeleteMission (co=0x813d540 <gCampaign>)
    at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogsed/editor_ui_common.c:67
#6  0x08055697 in Delete (xc=0, yc=0) at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogsed.c:658
#7  0x08054d87 in HandleInput (scrap=0xbfffe458, ycOld=<synthetic pointer>, xcOld=<synthetic pointer>, yc=0xbfffb450, 
    xc=<synthetic pointer>, m=<optimized out>, c=<optimized out>) at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogsed.c:1025
#8  EditCampaign () at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogsed.c:1105
#9  main (argc=1, argv=0xbffff634) at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogsed.c:1228

Relevant version: cc2ec91c29e6ea25cb518a10873d0dc37b10db31

Wuzzy2 commented 9 years ago

OK, here’s more info:

The same crash happens when doing this:

  1. Create or load a non-empty campaign
  2. Go the the end of the missions list
  3. Hit [Delete] or click on “Delete Mission” and confirm with “Y”