diff --git a/client/mysql.cc b/client/mysql.cc
index 5e09c309917..f1a140a6c5a 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2509,9 +2509,14 @@ print_table_data_xml(MYSQL_RES *result)
{
tee_fprintf(PAGER, "\t");
- xmlencode_print(cur[i], lengths[i]);
- tee_fprintf(PAGER, "\n");
+ if (cur[i])
+ {
+ tee_fprintf(PAGER, "\">");
+ xmlencode_print(cur[i], lengths[i]);
+ tee_fprintf(PAGER, "\n");
+ }
+ else
+ tee_fprintf(PAGER, "\" xsi:nil=\"true\" />\n");
}
(void) tee_fputs(" \n", PAGER);
}
diff --git a/mysql-test/r/client_xml.result b/mysql-test/r/client_xml.result
index 24c05c7f9d6..7395b2433e8 100644
--- a/mysql-test/r/client_xml.result
+++ b/mysql-test/r/client_xml.result
@@ -68,7 +68,7 @@ insert into t1 values (1, 2, 'a&b ab');
- NULL
+
drop table t1;