diff --git a/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifier.cs b/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifier.cs
index 86aaa68c82..414cf4bb56 100644
--- a/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifier.cs
+++ b/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifier.cs
@@ -112,17 +112,19 @@ public abstract partial class InteractionTest
}
///
- /// Convert an entity-uid to a matching entity specifier. Usefull when doing entity lookups & checking that the
- /// right quantity of entities/materials werre produced.
+ /// Convert an entity-uid to a matching entity specifier. Useful when doing entity lookups & checking that the
+ /// right quantity of entities/materials werre produced. Returns null if passed an entity with a null prototype.
///
- protected EntitySpecifier ToEntitySpecifier(EntityUid uid)
+ protected EntitySpecifier? ToEntitySpecifier(EntityUid uid)
{
if (SEntMan.TryGetComponent(uid, out StackComponent? stack))
return new EntitySpecifier(stack.StackTypeId, stack.Count) { Converted = true };
var meta = SEntMan.GetComponent(uid);
- Assert.That(meta.EntityPrototype, Is.Not.Null);
- return new(meta.EntityPrototype!.ID, 1) { Converted = true };
+ if (meta.EntityPrototype is null)
+ return null;
+
+ return new(meta.EntityPrototype.ID, 1) { Converted = true };
}
}
diff --git a/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifierCollection.cs b/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifierCollection.cs
index 0af2747662..520d2699c1 100644
--- a/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifierCollection.cs
+++ b/Content.IntegrationTests/Tests/Interaction/InteractionTest.EntitySpecifierCollection.cs
@@ -156,7 +156,9 @@ public abstract partial class InteractionTest
protected EntitySpecifierCollection ToEntityCollection(IEnumerable entities)
{
- var collection = new EntitySpecifierCollection(entities.Select(uid => ToEntitySpecifier(uid)));
+ var collection = new EntitySpecifierCollection(entities
+ .Select(ToEntitySpecifier)
+ .OfType());
Assert.That(collection.Converted);
return collection;
}
diff --git a/Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs b/Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs
index f59952afec..6c842f0082 100644
--- a/Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs
+++ b/Content.IntegrationTests/Tests/Interaction/InteractionTest.Helpers.cs
@@ -598,7 +598,7 @@ public abstract partial class InteractionTest
///
/// Performs an entity lookup and asserts that only the listed entities exist and that they are all present.
- /// Ignores the grid, map, player, target and contained entities.
+ /// Ignores the grid, map, player, target, contained entities, and entities with null prototypes.
///
protected async Task AssertEntityLookup(
EntitySpecifierCollection collection,
@@ -652,6 +652,9 @@ public abstract partial class InteractionTest
foreach (var uid in entities)
{
var found = ToEntitySpecifier(uid);
+ if (found is null)
+ continue;
+
if (spec.Prototype != found.Prototype)
continue;