Page 1 of 1

[0.8.8] Mod-triggered null pointer dereference

Posted: Mon Feb 10, 2014 11:26 am
by immibis
I ran into a null pointer dereference crash while trying to make a mod.

Steps to reproduce:
  • Download the mod (attached to this post) and install it.
  • Start a new game.
  • Spawn some items:

    Code: Select all

    game.getplayer().getinventory(defines.inventory.playermain).insert{name="crash-trigger-entity", count=1}
    game.getplayer().getinventory(defines.inventory.playermain).insert{name="small-electric-pole", count=1}
    game.getplayer().getinventory(defines.inventory.playermain).insert{name="solar-panel", count=1}
    
  • Place the electric pole. Place the solar panel and crash trigger entity within range of the electric pole.
  • Right-click the electric pole.
  • Crash!
Note: Despite what I called it, the crash-trigger-entity doesn't seem to directly cause the crash. An electric furnace-like entity is spawned when you place the crash-trigger-entity. If the electric furnace-like entity is not spawned, the crash does not occur.

Update: the crash is caused by the furnace-like entity not having a "placeable-player" or "placeable-neutral" flag.

Re: Mod-triggered null pointer dereference

Posted: Mon Feb 10, 2014 11:31 am
by kovarex
Hello, I would like to try it, but the mod is missing :)

Re: Mod-triggered null pointer dereference

Posted: Mon Feb 10, 2014 11:34 am
by immibis
kovarex wrote:Hello, I would like to try it, but the mod is missing :)
Fixed!

Re: [0.8.8] Mod-triggered null pointer dereference

Posted: Mon Feb 10, 2014 10:52 pm
by immibis
After more investigation, the crash does not occur if the electric-furnace-like entity (called iMod-aquifer-pump-powersink) has either the "placeable-neutral" or "placeable-player" flag. Maybe the game is trying to access the "order" field, which is required by either of these flags, and which was not set before.

Re: [0.8.8] Mod-triggered null pointer dereference

Posted: Fri Feb 28, 2014 2:19 pm
by kovarex
I tried it (I had to fix several 0.8.8 -> 0.9.x incompatibilities), but it doesn't crash now, so I guess it had been fixed on the way.

Re: [0.8.8] Mod-triggered null pointer dereference

Posted: Fri Aug 15, 2014 3:59 pm
by NooBxGockeL
dont mind me, just a bit of digging here!

This issue still exists!

Related Links:
Post informing me about this bug: https://forums.factorio.com/forum/vie ... 210#p41242
My Help request (in Modding Help) and finally found solution: https://forums.factorio.com/forum/vie ... =25&t=5373

#reopen

~Markus