]> git.deb.at Git - rhonda/theotherroles.git/commitdiff
Fix Evil Guesser cannot guess
authorfourthoneout <toma.onto@gmail.com>
Thu, 16 Dec 2021 05:49:31 +0000 (14:49 +0900)
committerfourthoneout <toma.onto@gmail.com>
Thu, 16 Dec 2021 05:49:31 +0000 (14:49 +0900)
Add null check to avoid for NullReferenceException in
`Guesser.remainingShots`.

Fix #264

TheOtherRoles/TheOtherRoles.cs

index 320fde337f287c78dd8dc0aa091a67af35f69607..8bb2a285d6e43e5d087536c27543c67abb297564 100644 (file)
@@ -1031,7 +1031,7 @@ namespace TheOtherRoles
 
         public static int remainingShots(byte playerId, bool shoot = false) {
             int remainingShots = remainingShotsEvilGuesser;
-            if (niceGuesser.PlayerId == playerId) {
+            if (niceGuesser != null && niceGuesser.PlayerId == playerId) {
                 remainingShots = remainingShotsNiceGuesser;
                 if (shoot) remainingShotsNiceGuesser = Mathf.Max(0, remainingShotsNiceGuesser - 1);
             } else if (shoot) {