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

Game crash on startup... #423

Closed ghost closed 8 years ago

ghost commented 8 years ago
Program terminated with signal SIGFPE, Arithmetic exception.
#0  0x000000000048372f in PicManagerGetRandomDrain (pm=0x711720 <gPicManager>)
    at /home/clemens/Projekte/cdogs-sdl/src/cdogs/pic_manager.c:1040
1040        NamedPic **p = CArrayGet(&pm->drainPics, rand() % pm->drainPics.size);
ghost commented 8 years ago

@cxong Also, the editor crashes once I insert a level with:


Program terminated with signal SIGFPE, Arithmetic exception.
#0  ObjAdd (amo=...) at /home/clemens/Projekte/cdogs-sdl/src/cdogs/objs.c:392
392     MapTryMoveTileItem(&gMap, &o->tileItem, Net2Vec2i(amo.Pos));
cxong commented 8 years ago

Please try again; I've added a possible fix

ghost commented 8 years ago

@cxong Thanks! That fixed it, but now I get a crash after finishing the round of a dogfight. When you are at the intermediate score screen and then press enter, it crashes with this stacktrace:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
106 ../sysdeps/x86_64/strlen.S: no such file or directory

According to some SO entry it may be that NULL gets passed to strlen, but since strlen is written in assembly, gdb can't make sense of it.

cxong commented 8 years ago

Can you give a full stack trace? I can't tell where in the code that is

ghost commented 8 years ago

@cxong Right, sorry, I completely forgot that is possible.

#0  strlen () at ../sysdeps/x86_64/strlen.S:106
#1  0x000000000041ea16 in MenuCreate (name=0x0, type=MENU_TYPE_BASIC)
    at /home/clemens/Projekte/cdogs-sdl/src/menu.c:324
#2  0x0000000000428d28 in WeaponMenuCreate (menu=0x7ffe80712860, numPlayers=2, 
    player=0, playerUID=0, handlers=0x70d0a0 <gEventHandlers>, 
    graphics=0x711380 <gGraphicsDevice>)
    at /home/clemens/Projekte/cdogs-sdl/src/weapon_menu.c:209
#3  0x00000000004263ad in PlayerEquip ()
    at /home/clemens/Projekte/cdogs-sdl/src/prep.c:605
#4  0x0000000000426e94 in Campaign (graphics=0x711380 <gGraphicsDevice>, 
    co=0x711220 <gCampaign>)
    at /home/clemens/Projekte/cdogs-sdl/src/screens.c:170
#5  0x0000000000426c55 in ScreenStart ()
    at /home/clemens/Projekte/cdogs-sdl/src/screens.c:106
#6  0x0000000000417335 in MainLoop (creditsDisplayer=0x7ffe80712cd0, 
    campaigns=0x7ffe80712d10)
    at /home/clemens/Projekte/cdogs-sdl/src/cdogs.c:117
#7  0x00000000004198bd in main (argc=1, argv=0x7ffe80714068)
    at /home/clemens/Projekte/cdogs-sdl/src/cdogs.c:489
cxong commented 8 years ago

Thanks; please confirm the fix

ghost commented 8 years ago

@cxong Confirmed, thanks for fixing.