RimWorldCCLTeam / CommunityCoreLibrary

For full details see the official Ludeon Forums thread.
https://ludeon.com/forums/index.php?topic=16599.0
The Unlicense
60 stars 27 forks source link

Minimap SaveKey may return null for dynamic overlays #163

Closed ForsakenShell closed 7 years ago

ForsakenShell commented 7 years ago

@biship reported in commit e211d66a7b9b8cb23ca191aec436623497ee0e4e

Using this commit, saves workfine until I changed a minimap setting (toggled the zone or viewport setting). Now I can't save. I am using dev branch, latest commit: 4343ac7

But it's possibly this regex change that introduced the bug.

To reproduce, load a game, save (saves fine), change one or some of the minimap settings, & you get this error on next save.

An exception was thrown during saving to "C:\Users\nick\AppData\LocalLow\Ludeon Studios\RimWorld\Saves\Colonistites3.rws": System.ArgumentNullException: Argument cannot be null. Parameter name: input at System.Text.RegularExpressions.Regex.Replace (System.String input, System.String replacement, Int32 count, Int32 startat) [0x00000] in :0 at System.Text.RegularExpressions.Regex.Replace (System.String input, System.String replacement) [0x00000] in :0 at CommunityCoreLibrary.MiniMap.MiniMapOverlay.get_SaveKey () [0x00000] in :0 at CommunityCoreLibrary.MiniMap.MiniMapController.ExposeDataSave () [0x00000] in :0 at CommunityCoreLibrary.MiniMap.MiniMapController.ExposeData () [0x00000] in :0 at Verse.Scribe_Deep.LookDeep[MapComponent](Verse.MapComponent& target, Boolean saveDestroyedThings, System.String label, System.Object[] ctorArgs) [0x00000] in :0 at Verse.Scribe_Collections.LookList[MapComponent](System.Collections.Generic.List1& list, Boolean saveDestroyedThings, System.String label, LookMode lookMode, System.Object[] ctorArgs) [0x00000] in :0 at Verse.Scribe_Collections.LookListMapComponent [0x00000] in :0 at Verse.Map.ExposeComponents () [0x00000] in :0 at Verse.Map.ExposeData () [0x00000] in :0 at Verse.Scribe_Deep.LookDeepMap [0x00000] in :0 at Verse.Scribe_Deep.LookDeepMap [0x00000] in :0 at Verse.Game.ExposeData () [0x00000] in :0 at Verse.Scribe_Deep.LookDeepGame [0x00000] in :0 at Verse.Scribe_Deep.LookDeepGame [0x00000] in :0 at Verse.GameDataSaveLoader.m__814 () [0x00000] in :0 at Verse.SafeSaver.DoSave (System.String fullPath, System.String documentElementName, System.Action saveAction) [0x00000] in :0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Exception while saving map: System.ArgumentNullException: Argument cannot be null. Parameter name: input at System.Text.RegularExpressions.Regex.Replace (System.String input, System.String replacement, Int32 count, Int32 startat) [0x00000] in :0 at System.Text.RegularExpressions.Regex.Replace (System.String input, System.String replacement) [0x00000] in :0 at CommunityCoreLibrary.MiniMap.MiniMapOverlay.get_SaveKey () [0x00000] in :0 at CommunityCoreLibrary.MiniMap.MiniMapController.ExposeDataSave () [0x00000] in :0 at CommunityCoreLibrary.MiniMap.MiniMapController.ExposeData () [0x00000] in :0 at Verse.Scribe_Deep.LookDeepMapComponent [0x00000] in :0 at Verse.Scribe_Collections.LookListMapComponent [0x00000] in :0 at Verse.Scribe_Collections.LookListMapComponent [0x00000] in :0 at Verse.Map.ExposeComponents () [0x00000] in :0 at Verse.Map.ExposeData () [0x00000] in :0 at Verse.Scribe_Deep.LookDeepMap [0x00000] in :0 at Verse.Scribe_Deep.LookDeepMap [0x00000] in :0 at Verse.Game.ExposeData () [0x00000] in :0 at Verse.Scribe_Deep.LookDeepGame [0x00000] in :0 at Verse.Scribe_Deep.LookDeepGame [0x00000] in :0 at Verse.GameDataSaveLoader.m__814 () [0x00000] in :0 at Verse.SafeSaver.DoSave (System.String fullPath, System.String documentElementName, System.Action saveAction) [0x00000] in :0

ForsakenShell commented 7 years ago

@biship:

Can you provide a list of the area names? The regex is removing "non-word characters" so it can create a "valid save key". I didn't think about what would happen if there were no valid characters in the label.

biship commented 7 years ago

I only have a few areas in the game. Home, Outside & Shop. All English text. I pulled all Area_ from the save. There seems to be some inbuilt game hidden areas too.

`

  • Area_Named_Outside Area_Home Area_Named_Shop
  • Area_Home
  • Area_Named_Outside
  • ` Sorry for posting on the commit. I didn't want to open a issue and then have it closed being told the dev branch is only for testing!
    ForsakenShell commented 7 years ago

    No worries, but all issues whether it's the master or the development branch should go into the tracker. They'll get lost if in the commits.

    Anyway, problem is fixed now. :)