KongMD-Steam / QuestionableEthicsEnhanced

The source code of the Questionable Ethics Enhanced mod for RimWorld.
MIT License
12 stars 7 forks source link

NullReferenceException occasionally when extracting vat product #71

Closed KongMD-Steam closed 4 years ago

KongMD-Steam commented 5 years ago

Describe the bug Occasionally, the job that extracts the product from the vats throws a NullReferenceException. The bug only seems to be present at very low growth time settings, so it's possibly a race condition. I suspect the problem is the Extract job trying to Start a new hauling job while the extract Job is still in-progress.

Stack trace:

JobDriver threw exception in initAction for pawn Whitaker driver=JobDriver_ExtractProductFromGrower (toilIndex=3) driver.job=(QE_ExtractProductFromGrowerJob (Job_20639) A=Thing_QE_Building_OrganVat58295) lastJobGiver=RimWorld.JobGiver_Work
System.NullReferenceException: Object reference not set to an instance of an object
  at Verse.AI.Pawn_JobTracker.StartJob (Verse.AI.Job newJob, JobCondition lastJobEndCondition, Verse.AI.ThinkNode jobGiver, Boolean resumeCurJobAfterwards, Boolean cancelBusyStances, Verse.ThinkTreeDef thinkTree, Nullable`1 tag, Boolean fromQueue) [0x00000] in <filename unknown>:0 
  at QEthics.Building_OrganVat.TryExtractProduct (Verse.Pawn actor) [0x00000] in <filename unknown>:0 
  at QEthics.JobDriver_ExtractProductFromGrower.<MakeNewToils>b__1_0 () [0x00000] in <filename unknown>:0 
  at Verse.AI.JobDriver.TryActuallyStartNextToil () [0x00000] in <filename unknown>:0 
Verse.Log:Error(String, Boolean)
Verse.AI.JobUtility:TryStartErrorRecoverJob(Pawn, String, Exception, JobDriver)
Verse.AI.JobDriver:TryActuallyStartNextToil()
etc.

Expected behavior Any null references are checked and skipped.

To Reproduce Still unclear. No mod users have reported it, so I suspect it's not happening with default ModSettings.

KongMD-Steam commented 4 years ago

The Organ Vat and job AI has been overhauled. This should no longer be happening.