Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  


Starsector 0.95a is out! (03/26/21); Blog post: Skill Changes, Part 2 (07/15/21)

Author Topic: [0.8.1a RC8] NPE – event report recursion?  (Read 1072 times)


  • Admiral
  • *****
  • Posts: 3281
    • View Profile
    • Bitbucket profile
    • Email
[0.8.1a RC8] NPE – event report recursion?
« on: June 07, 2017, 06:31:03 AM »

I have a crash where if an event report has a message priority DELIVER_IMMEDIATELY, and its on-delivery script causes another event to be reported with DELIVER_IMMEDIATELY, the game NPEs.

ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
at com.fs.starfarer.campaign.comms.CommSystem.deliverMessages(Unknown Source)
at com.fs.starfarer.campaign.comms.CommSystem.addMessage(Unknown Source)
at com.fs.starfarer.campaign.comms.CommSystem.addMessage(Unknown Source)
at com.fs.starfarer.campaign.CampaignEngine.reportEventStage(Unknown Source)
at com.fs.starfarer.api.impl.campaign.missions.FactionCommissionMissionEvent.startEvent(
at Source)
at com.fs.starfarer.api.impl.campaign.missions.FactionCommissionMission.playerAccept(
at com.fs.starfarer.ui.newui.CommDirectoryDialog.actionPerformed(Unknown Source)
at com.fs.starfarer.ui.j.o00000(Unknown Source)
at com.fs.starfarer.ui.I.processInput(Unknown Source)
at com.fs.starfarer.ui.V.o00000(Unknown Source)
at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$ Source)
at Source)

Steps to reproduce (don't have a minimal mod handy right now, unfortunately):
- Start a Nexerelin game with "free start" faction (in vanilla section of dialog)
- Console command: setrelationship hegemony 51
- Console command: createalliance hegemony player_npc
- Open Jangala's comm board and accept a commission

Changing the message priority here to ENSURE_DELIVERY prevents the crash.


  • Administrator
  • Admiral
  • *****
  • Posts: 18940
    • View Profile
Re: [0.8.1a RC8] NPE – event report recursion?
« Reply #1 on: June 07, 2017, 02:16:06 PM »

Is your on-delivery script doing something like:

It's pretty difficult to see this happening otherwise...

The core code is:
Code: java
boolean deliver = true;
if (envelope.message.getOnDelivery() != null) {

// and this is where it crashes due to envelope.message.getOnDelivery() == null
deliver = envelope.message.getOnDelivery().shouldDeliver();