Skip to content

Commit

Permalink
Fix: ReverseCommands.Tools.GetPawnActions casts NRE in world map
Browse files Browse the repository at this point in the history
[v1.0.7]
  • Loading branch information
pardeike committed Oct 14, 2018
1 parent c731ae4 commit d20a5b7
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 24 deletions.
34 changes: 17 additions & 17 deletions About/Manifest.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest>
<identifier>net.pardeike.rimworld.mod.reversecommands</identifier>
<version>1.0.6.0</version>
<targetVersions>
<li>0.19.0</li>
<li>1.0.0</li>
</targetVersions>
<dependencies>
</dependencies>
<incompatibleWith>
</incompatibleWith>
<loadBefore>
</loadBefore>
<loadAfter>
</loadAfter>
<manifestUri>https://raw.githubusercontent.com/pardeike/ReverseCommands/master/About/Manifest.xml</manifestUri>
<downloadUri>https://github.com/pardeike/ReverseCommands/releases/latest</downloadUri>
<identifier>net.pardeike.rimworld.mod.reversecommands</identifier>
<version>1.0.7.0</version>
<targetVersions>
<li>0.19.0</li>
<li>1.0.0</li>
</targetVersions>
<dependencies>
</dependencies>
<incompatibleWith>
</incompatibleWith>
<loadBefore>
</loadBefore>
<loadAfter>
</loadAfter>
<manifestUri>https://raw.githubusercontent.com/pardeike/ReverseCommands/master/About/Manifest.xml</manifestUri>
<downloadUri>https://github.com/pardeike/ReverseCommands/releases/latest</downloadUri>
</Manifest>
4 changes: 2 additions & 2 deletions About/ModSync.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ModSyncNinjaData>
<ID>58bdfb23-60ad-449c-9e2d-c58a0d2c5ce2</ID>
<ModName>Reverse Commands</ModName>
<Version>1.0.6.0</Version>
<Version>1.0.7.0</Version>
<SaveBreaking>False</SaveBreaking>
<Host name="Github">
<Owner>pardeike</Owner>
Expand All @@ -11,4 +11,4 @@
<DownloadFrom>ModSyncMainPage</DownloadFrom>
<Branch>master</Branch>
</Host>
</ModSyncNinjaData>
</ModSyncNinjaData>
Binary file modified Assemblies/ReverseCommands.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions Source/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("1.0.6.0")]
[assembly: AssemblyFileVersion("1.0.6.0")]
[assembly: AssemblyVersion("1.0.7.0")]
[assembly: AssemblyFileVersion("1.0.7.0")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
Expand Down
5 changes: 4 additions & 1 deletion Source/ReverseCommands.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\NuGet.Build.Packaging.0.1.157-dev\build\NuGet.Build.Packaging.targets" Condition="Exists('..\packages\NuGet.Build.Packaging.0.1.157-dev\build\NuGet.Build.Packaging.targets')" />
<PropertyGroup>
<PostBuildEvent>"$(ProjectDir)Install.bat" $(ConfigurationName) "$(ProjectDir)" "$(ProjectName)" "About Assemblies"</PostBuildEvent>
<PostBuildEvent>ModBuilder -v AssemblyVersion -file "$(TargetPath)" -save "$(ProjectName)-version"
ModBuilder -v XMLPut -file "$(SolutionDir)About\Manifest.xml" -xpath /Manifest/version -value "{{$(ProjectName)-version}}"
ModBuilder -v XMLPut -file "$(SolutionDir)About\ModSync.xml" -xpath /ModSyncNinjaData/Version -value "{{$(ProjectName)-version}}"
"$(ProjectDir)Install.bat" $(ConfigurationName) "$(ProjectDir)" "$(ProjectName)" "About Assemblies"</PostBuildEvent>
</PropertyGroup>
</Project>
7 changes: 5 additions & 2 deletions Source/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ public static Dictionary<string, Dictionary<Pawn, FloatMenuOption>> GetPawnActio
{
var result = new Dictionary<string, Dictionary<Pawn, FloatMenuOption>>();

var firstSelectedPawn = Find.Selector.SelectedObjects.FirstOrDefault(o => o is Pawn && (o as Pawn).IsColonist);
var firstSelectedPawn = Find.Selector.SelectedObjects?.FirstOrDefault(o => o is Pawn && (o as Pawn).IsColonist);
if (firstSelectedPawn != null) return result;

Find.CurrentMap.mapPawns.FreeColonists.Where(PawnUsable).Do(pawn =>
var map = Find.CurrentMap;
if (map == null || map.mapPawns == null) return result;

map.mapPawns.FreeColonists.Where(PawnUsable).Do(pawn =>
{
var list = FloatMenuMakerMap.ChoicesAtFor(UI.MouseMapPosition(), pawn);
list.Where(option => option.Label != "Go here").Do(option =>
Expand Down

0 comments on commit d20a5b7

Please sign in to comment.