[1.2.2723] Selling arrested homeless refugees to Tribute Collectors causes bugs.

Started by Wemd, August 28, 2020, 01:16:47 PM

Previous topic - Next topic

Wemd

1. Circumstances:
I was playing an almost Vanilla game with Royalty and ~60 basic mods like "Pick Up And Haul".

2. What Happened:
I arrested 3 refugees and tried to sell them to imperial Tribute Collectors for Honor, but it didn't work. I only got a red string error and weird behavior.

3. Expected:
I expected to sell them as regular prisoners and get 9 honor, 3 for each.

4. Steps:
A. I've got a quest about homeless refugees. There were 3 of them. I've taken the quest, drafted the refugees and then arrested them all. Due the high level of "Social", I arrested them with 100% chance without need to down them.

B. About 40 days have passed before the collectors appeared.

C. There also were 2 regular prisoners from a tribal faction in the prison.

D. The prisoners started a prison break right before the collectors appeared. One of the refugees died. So 2 refugees and 2 tribals left.

E. The collectors appeared. I tried to sell all 4 prisoners. All 4 were available to sell in the trading window. And then something went wrong:
The tribals were sold sucessefully, and the refugees weren't. I've got a red error string in the console:
"Could not do PostLoadInit on RimWorld.Pawn_Ownership: System.InvalidOperationException: Failed to compare two elements in the array."
The leader of the refugees just walked out of the prison and started acting as a colonist. He went to change clothes and get some food as a normal recruited pawn, but I never tried to recruit him.

F. I've arrested him back and tried to sell him again, but it didn't work.

G. So I had to turn the  Dev. Mode on, destroy bugged refugees and add Honor for them manually.


5. Save file: https://www.dropbox.com/s/02kc96utbli72t2/Crashlanded3%20%28Permadeath%29.rar?dl=0

6. Log: https://www.dropbox.com/s/rfhy5o2hjij2vcn/Player.rar?dl=0

Screenshots: https://www.dropbox.com/s/2v4h39rj6qk9dqj/Screenshots.rar?dl=0



I didn't have any mods related to factions, prisoners or refugees installed. I already played with all these mods before, but never had any issues with prisoners selling. So I doubt it was a bug caused by mods.

Text from the red string:

Could not do PostLoadInit on RimWorld.Pawn_Ownership: System.InvalidOperationException: Failed to compare two elements in the array. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorld.CompAssignableToPawn+<>c.<SortAssignedPawns>b__17_0 (Verse.Pawn x) [0x00000] in <7b345446a85d4ed599f9c604ae61854b>:0
  at Verse.GenCollection+<>c__DisplayClass24_0`2[T,TSortBy].<SortBy>b__0 (T a, T b) [0x00000] in <7b345446a85d4ed599f9c604ae61854b>:0
  at System.Collections.Generic.ArraySortHelper`1[T].SwapIfGreater (T[] keys, System.Comparison`1[T] comparer, System.Int32 a, System.Int32 b) [0x00004] in <567df3e0919241ba98db88bec4c6696f>:0
  at System.Collections.Generic.ArraySortHelper`1[T].IntroSort (T[] keys, System.Int32 lo, System.Int32 hi, System.Int32 depthLimit, System.Comparison`1[T] comparer) [0x00019] in <567df3e0919241ba98db88bec4c6696f>:0
  at System.Collections.Generic.ArraySortHelper`1[T].IntrospectiveSort (T[] keys, System.Int32 left, System.Int32 length, System.Comparison`1[T] comparer) [0x00015] in <567df3e0919241ba98db88bec4c6696f>:0
  at System.Collections.Generic.ArraySortHelper`1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison`1[T] comparer) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0
   --- End of inner exception stack trace ---
  at System.Collections.Generic.ArraySortHelper`1[T].Sort (T[] keys, System.Int32 index, System.Int32 length, System.Comparison`1[T] comparer) [0x00020] in <567df3e0919241ba98db88bec4c6696f>:0
  at System.Collections.Generic.List`1[T].Sort (System.Comparison`1[T] comparison) [0x00012] in <567df3e0919241ba98db88bec4c6696f>:0
  at Verse.GenCollection.SortBy[T,TSortBy] (System.Collections.Generic.List`1[T] list, System.Func`2[T,TResult] selector) [0x00017] in <7b345446a85d4ed599f9c604ae61854b>:0
  at RimWorld.CompAssignableToPawn.SortAssignedPawns () [0x00000] in <7b345446a85d4ed599f9c604ae61854b>:0
  at RimWorld.CompAssignableToPawn.ForceAddPawn (Verse.Pawn pawn) [0x0001a] in <7b345446a85d4ed599f9c604ae61854b>:0
  at RimWorld.Pawn_Ownership.ClaimGrave (RimWorld.Building_Grave newGrave) [0x00036] in <7b345446a85d4ed599f9c604ae61854b>:0
  at RimWorld.Pawn_Ownership.ExposeData () [0x000eb] in <7b345446a85d4ed599f9c604ae61854b>:0
  at Verse.PostLoadIniter.DoAllPostLoadInits () [0x00032] in <7b345446a85d4ed599f9c604ae61854b>:0

Verse.Log:Error(String, Boolean)
Verse.PostLoadIniter:DoAllPostLoadInits()
Verse.ScribeLoader:FinalizeLoading()
Verse.Game:LoadGame()
Verse.SavedGameLoaderNow:Verse.SavedGameLoaderNow.LoadGameFromSaveFileNow_Patch1(String)
Verse.<>c:<Start>b__1_1()
Verse.LongEventHandler:RunEventFromAnotherThread(Action)
Verse.<>c:<UpdateCurrentAsynchronousEvent>b__27_0()
System.Threading.ThreadHelper:ThreadStart_Context(Object)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object)
System.Threading.ThreadHelper:ThreadStart()

Mr_Fission

Not sure if it's related, but I had a similar (though not exact) thing happen in one of my games.

I arrested three refugees, and whenever any of the arrests caused the remaining refugees to depart the colony, one specific refugee couldn't be given to the tribute collector.

Whenever I'd gift that specific prisoner, nothing would happen.  And then they would walk out of the prison and act like a normal colonist, but they wouldn't appear on the list of colonists at the top of my screen. 

My instance of this bug was with zero mods.

Wemd

Quote from: Mr_Fission on August 28, 2020, 05:53:10 PM
Not sure if it's related, but I had a similar (though not exact) thing happen in one of my games.

I arrested three refugees, and whenever any of the arrests caused the remaining refugees to depart the colony, one specific refugee couldn't be given to the tribute collector.

Whenever I'd gift that specific prisoner, nothing would happen.  And then they would walk out of the prison and act like a normal colonist, but they wouldn't appear on the list of colonists at the top of my screen. 

My instance of this bug was with zero mods.

Yes, exactly!

It seems something is wrong with the new "temporary factions", added recently to refugee quests.
Feels like such faction relations chain them to each other hard and it breaks other pawn-related mechanics.

Mr_Fission

So I'm curious - I'd like to ask a few questions to see if we're experiencing the same bug, if I may.

1) Did your affected pawn have any health conditions?  Mine had an addiction to Wake-Up.
2) Was your affected pawn carrying any drugs in their inventory when you arrested them?  Mine was carrying Wake-Up.
3) When you arrested your pawns, did any of your arrests cause a "Guest: Departure" result for the other guests?  The bug only happened for me when that result occurred.
4) If you arrest ONLY that one affected pawn, and ignore the other pawns, are you able to sell that pawn under any circumstances?  In my case, if I didn't cause a "Guest: Departure" result, I could sell mine to the Tribute Collector no problem.

Wemd

Oh, I don't remember such things really.
They had no addictions or drugs at least. I arrested the leader first,  but don't remember if 2 other ones tried to go away or no.

Pheanox

I believe this is going to be a duplicate bug report.  I am going to link to this post with the bug report I've already made.  I believe it is related to arresting the leader first.  Will have the devs check it out.