Commit c60b1846 authored by unknown's avatar unknown

Safety fix


sql/item_cmpfunc.cc:
  Safety fix
  Code cleanup
parent 44dcd7e8
...@@ -2047,7 +2047,8 @@ int cmp_item_row::compare(cmp_item *c) ...@@ -2047,7 +2047,8 @@ int cmp_item_row::compare(cmp_item *c)
void cmp_item_decimal::store_value(Item *item) void cmp_item_decimal::store_value(Item *item)
{ {
my_decimal *val= item->val_decimal(&value); my_decimal *val= item->val_decimal(&value);
if (val != &value) /* val may be zero if item is nnull */
if (val && val != &value)
my_decimal2decimal(val, &value); my_decimal2decimal(val, &value);
} }
...@@ -2061,9 +2062,9 @@ int cmp_item_decimal::cmp(Item *arg) ...@@ -2061,9 +2062,9 @@ int cmp_item_decimal::cmp(Item *arg)
} }
int cmp_item_decimal::compare(cmp_item *c) int cmp_item_decimal::compare(cmp_item *arg)
{ {
cmp_item_decimal *cmp= (cmp_item_decimal *)c; cmp_item_decimal *cmp= (cmp_item_decimal*) arg;
return my_decimal_cmp(&value, &cmp->value); return my_decimal_cmp(&value, &cmp->value);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment