ICU-6132 Make sure that operator == does not dereference unit if it is null.

X-SVN-Rev: 23210
This commit is contained in:
Michael Ow 2008-01-11 22:02:07 +00:00
parent 3edc99506c
commit 10ad732dbf

View File

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (c) 2004, International Business Machines
* Copyright (c) 2004-2008, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@ -49,8 +49,8 @@ Measure::~Measure() {
UBool Measure::operator==(const UObject& other) const {
const Measure* m = (const Measure*) &other;
return getDynamicClassID() == other.getDynamicClassID() &&
number == m->getNumber() &&
*unit == m->getUnit();
number == m->getNumber() &&
(unit != NULL && *unit == m->getUnit());
}
//----------------------------------------------------------------------