From dc5ce03f7f0f926190b07b294f2a79cc68fd12d4 Mon Sep 17 00:00:00 2001
From: unknown <hf@deer.mysql.r18.ru>
Date: Wed, 8 Jan 2003 19:42:31 +0400
Subject: [PATCH] Fix for the bug about point(subselect(...))

sql/item_strfunc.cc:
  null_value-s was indefined here
---
 sql/item_strfunc.cc | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index d2b0e89254..7818a23fcd 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2666,6 +2666,9 @@ Functions to concatinate various spatial objects
 
 String *Item_func_point::val_str(String *str)
 {
+  double x= args[0]->val();
+  double y= args[1]->val();
+
   if ( (null_value = (args[0]->null_value ||
                      args[1]->null_value ||
                      str->realloc(1+4+8+8))))
@@ -2674,8 +2677,8 @@ String *Item_func_point::val_str(String *str)
   str->length(0);
   str->q_append((char)Geometry::wkbNDR);
   str->q_append((uint32)Geometry::wkbPoint);
-  str->q_append((double)args[0]->val());
-  str->q_append((double)args[1]->val());
+  str->q_append(x);
+  str->q_append(y);
   return str;
 }
 
@@ -2707,11 +2710,10 @@ String *Item_func_spatial_collection::val_str(String *str)
 
   for (i = 0; i < arg_count; ++i)
   {
+    String *res = args[i]->val_str(&arg_value);
     if (args[i]->null_value)
       goto ret;
 
-    String *res = args[i]->val_str(&arg_value);
-
     if ( coll_type == Geometry::wkbGeometryCollection )
     {
       /*
-- 
2.30.9