ATLAS-2299: Regression : Creating an entity of unknown type throws NPE
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityGraphDiscoveryV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityGraphDiscoveryV1.java
index 739d610..1fc1a06 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityGraphDiscoveryV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityGraphDiscoveryV1.java
@@ -345,6 +345,10 @@
 
         AtlasEntityType type = typeRegistry.getEntityTypeByName(entity.getTypeName());
 
+        if (type == null) {
+            throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_TYPENAME, entity.getTypeName());
+        }
+
         recordObjectReference(entity.getGuid());
 
         visitEntity(type, entity);