Safety fix

sql/item_cmpfunc.cc:
  Safety fix
  Code cleanup
This commit is contained in:
unknown 2005-02-15 19:35:28 +02:00
parent 44dcd7e8ea
commit c60b184629

View file

@ -2047,7 +2047,8 @@ int cmp_item_row::compare(cmp_item *c)
void cmp_item_decimal::store_value(Item *item)
{
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);
}
@ -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);
}