Fixed nullref exceptions in CharacterHUD & RuinGenerator
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public static void TakeDamage(float amount)
|
public static void TakeDamage(float amount)
|
||||||
{
|
{
|
||||||
healthBar.Flash();
|
healthBar?.Flash();
|
||||||
|
|
||||||
damageOverlayTimer = MathHelper.Clamp(amount * 0.1f, 0.2f, 1.0f);
|
damageOverlayTimer = MathHelper.Clamp(amount * 0.1f, 0.2f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -423,6 +423,7 @@ namespace Barotrauma.RuinGeneration
|
|||||||
Alignment[] alignments = new Alignment[] { Alignment.Top, Alignment.Bottom, Alignment.Right, Alignment.Left, Alignment.Center };
|
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)]);
|
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;
|
Vector2 size = (prop.Prefab is StructurePrefab) ? ((StructurePrefab)prop.Prefab).Size : Vector2.Zero;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user