diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module
index 4d9cc75..8fb8d1c 100644
--- a/core/modules/comment/comment.module
+++ b/core/modules/comment/comment.module
@@ -964,17 +964,19 @@ function comment_entity_insert(EntityInterface $entity) {
  * Implements hook_entity_predelete().
  */
 function comment_entity_predelete(EntityInterface $entity) {
-  $cids = db_select('comment', 'c')
-    ->fields('c', array('cid'))
-    ->condition('entity_id', $entity->id())
-    ->condition('entity_type', $entity->getEntityTypeId())
-    ->execute()
-    ->fetchCol();
-  entity_delete_multiple('comment', $cids);
-  db_delete('comment_entity_statistics')
-    ->condition('entity_id', $entity->id())
-    ->condition('entity_type', $entity->getEntityTypeId())
-    ->execute();
+  if ($entity->getEntityType()->isFieldable() && is_int($entity->id())) {
+    $cids = db_select('comment', 'c')
+      ->fields('c', array('cid'))
+      ->condition('entity_id', $entity->id())
+      ->condition('entity_type', $entity->getEntityTypeId())
+      ->execute()
+      ->fetchCol();
+    entity_delete_multiple('comment', $cids);
+    db_delete('comment_entity_statistics')
+      ->condition('entity_id', $entity->id())
+      ->condition('entity_type', $entity->getEntityTypeId())
+      ->execute();
+  }
 }
 
 /**
