diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result
index c18be2df403fbf277abb2bdc723478a419e12157..652913d1fdb47e5de7b188ff242573dba69c1bf6 100644
--- a/mysql-test/r/sql_mode.result
+++ b/mysql-test/r/sql_mode.result
@@ -138,3 +138,5 @@ t1	CREATE TABLE `t1` (
   `min_num` decimal(7,6) default '0.000001'
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1 ;
+set @@SQL_MODE=NULL;
+ERROR 42000: Variable 'sql_mode' can't be set to the value of 'NULL'
diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test
index f841d36e837f841a66f2f400a235f12713f73325..985c0853bd2169fdb347eca3ceda5605df968a96 100644
--- a/mysql-test/t/sql_mode.test
+++ b/mysql-test/t/sql_mode.test
@@ -80,3 +80,8 @@ create table t1 ( min_num   dec(6,6)     default .000001);
 show create table t1;
 drop table t1 ;
 
+#
+# Bug #10732: Set SQL_MODE to NULL gives garbled error message
+#
+--error 1231
+set @@SQL_MODE=NULL;
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 0fa9932dbbc7eb9449d8b0730b7a4275565ed15f..0f13a8a7f2d32f8fc2d4c9e664d28481b42162fa 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1515,7 +1515,10 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
   if (var->value->result_type() == STRING_RESULT)
   {
     if (!(res= var->value->val_str(&str)))
+    {
+      strmake(buff, "NULL", 4);
       goto err;
+    }
     var->save_result.ulong_value= ((ulong)
 				   find_set(enum_names, res->c_ptr(),
 					    res->length(),