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 when inserting a map item #312

Closed Wuzzy2 closed 9 years ago

Wuzzy2 commented 9 years ago

What I did:

  1. Start editor
  2. Create map
  3. Click on “Map items” and press [Insert]

The editor crashes with this error:

cdogs-sdl-editor: /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogs/c_array.c:101: CArrayGet: Assertion `idx >= 0 && idx < (int)a->size' failed.

Backtrace from GNU Debugger:

Program received signal SIGABRT, Aborted.
0xffffe424 in __kernel_vsyscall ()
(gdb) bt
#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  0x0806cb61 in CArrayGet (a=0x813d4ec <gMission+44>, idx=0) at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogs/c_array.c:101
#6  0x0805b0ce in MissionDrawMapItem (o=0xc297a58, g=0x813dc40 <gGraphicsDevice>, pos=..., vData=0xc297ae8)
    at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogsed/editor_ui.c:688
#7  0x08062503 in UIObjectDrawAndAddChildren (o=0x0, g=0x6, pos=..., mouse=..., objs=0x0)
    at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogsed/ui_object.c:457
#8  0x080631ff in UIObjectDraw (o=0x0, g=0x813dc40 <gGraphicsDevice>, pos=..., mouse=..., drawObjs=0x8125648 <sDrawObjs>)
    at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogsed/ui_object.c:507
#9  0x08053d7c in Display (g=<optimized out>, yc=<optimized out>, result=...)
    at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogsed.c:262
#10 EditCampaign () at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogsed.c:1115
#11 main (argc=1, argv=0xbffff634) at /home/wuzzy/src/cdogs-sdl/cdogs-sdl/src/cdogsed.c:1228

Version: cc2ec91c29e6ea25cb518a10873d0dc37b10db31

This may be related to #308, but the backtrace looks different, so I filed a new issue.

cxong commented 9 years ago

This bug was caused by an incorrect attempt at fixing #305; thanks for reporting!