diff --git a/entityform_block.module b/entityform_block.module
index a5d764e..84f8127 100644
--- a/entityform_block.module
+++ b/entityform_block.module
@@ -194,8 +194,8 @@ function entityform_block_get_entity($type){
  * Deletes blocks if the entity type is deleted.
  */
 function entityform_block_entity_delete($entity, $entity_type) {
-  $type = $entity->type;
   if ($entity_type == "entityform_type") {
+    $type = $entity->type;
     $types = variable_get('entityform_block_types');
     if (entityform_block_exists($types, $type)) {
       $key = array_search($type, $types);
