diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index c4dbb5f3241b3f86294fc6db156087c18352cb55..03074ee3ba97fedd724538ea7e7ce43cf3d64961 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1506,7 +1506,8 @@ memory to write 'DELETE FROM `%s`.`%s`' to the binary log",db,name);
   DBUG_RETURN(0);
 err:
   /* Hide "Table doesn't exist" errors if table belong to view */
-  if (thd->net.last_errno == ER_NO_SUCH_TABLE && table_desc->belong_to_view)
+  if (thd->net.last_errno == ER_NO_SUCH_TABLE &&
+      table_desc && table_desc->belong_to_view)
   {
     TABLE_LIST * view= table_desc->belong_to_view;
     thd->clear_error();