[0.8.8] Mod-triggered null pointer dereference

This subforum contains all the issues which we already resolved.
Post Reply
immibis
Filter Inserter
Filter Inserter
Posts: 303
Joined: Sun Mar 24, 2013 2:25 am
Contact:

[0.8.8] Mod-triggered null pointer dereference

Post 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.
Attachments
iMod-crashtest.zip
(4.06 KiB) Downloaded 92 times
Last edited by immibis on Tue Feb 11, 2014 10:58 am, edited 6 times in total.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Mod-triggered null pointer dereference

Post by kovarex »

Hello, I would like to try it, but the mod is missing :)

immibis
Filter Inserter
Filter Inserter
Posts: 303
Joined: Sun Mar 24, 2013 2:25 am
Contact:

Re: Mod-triggered null pointer dereference

Post by immibis »

kovarex wrote:Hello, I would like to try it, but the mod is missing :)
Fixed!

immibis
Filter Inserter
Filter Inserter
Posts: 303
Joined: Sun Mar 24, 2013 2:25 am
Contact:

Re: [0.8.8] Mod-triggered null pointer dereference

Post 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.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.8.8] Mod-triggered null pointer dereference

Post 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.

User avatar
NooBxGockeL
Burner Inserter
Burner Inserter
Posts: 10
Joined: Sat Aug 02, 2014 7:20 pm
Contact:

Re: [0.8.8] Mod-triggered null pointer dereference

Post 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

Post Reply

Return to “Resolved Problems and Bugs”