Fixed nullref exceptions in CharacterHUD & RuinGenerator

This commit is contained in:
Joonas Rikkonen
2018-07-20 11:36:53 +03:00
parent f13b1b4d84
commit 8e03ac9284
2 changed files with 2 additions and 1 deletions

View File

@@ -32,7 +32,7 @@ namespace Barotrauma
public static void TakeDamage(float amount)
{
healthBar.Flash();
healthBar?.Flash();
damageOverlayTimer = MathHelper.Clamp(amount * 0.1f, 0.2f, 1.0f);
}

View File

@@ -423,6 +423,7 @@ namespace Barotrauma.RuinGeneration
Alignment[] alignments = new Alignment[] { Alignment.Top, Alignment.Bottom, Alignment.Right, Alignment.Left, Alignment.Center };
var prop = RuinStructure.GetRandom(RuinStructureType.Prop, alignments[Rand.Int(alignments.Length, Rand.RandSync.Server)]);
if (prop == null) continue;
Vector2 size = (prop.Prefab is StructurePrefab) ? ((StructurePrefab)prop.Prefab).Size : Vector2.Zero;