if (this == &other) {
return *this;
}
- delete fImpl;
+ if (fImpl != nullptr) {
+ delete fImpl;
+ }
if (other.fImpl) {
ErrorCode localStatus;
fImpl = new MeasureUnitImpl(other.fImpl->copy(localStatus));
if (this == &other) {
return *this;
}
- delete fImpl;
+ if (fImpl != nullptr) {
+ delete fImpl;
+ }
fImpl = other.fImpl;
other.fImpl = nullptr;
fTypeId = other.fTypeId;
}
MeasureUnit::~MeasureUnit() {
- delete fImpl;
- fImpl = nullptr;
+ if (fImpl != nullptr) {
+ delete fImpl;
+ fImpl = nullptr;
+ }
}
const char *MeasureUnit::getType() const {
void MeasureUnit::setTo(int32_t typeId, int32_t subTypeId) {
fTypeId = typeId;
fSubTypeId = subTypeId;
- delete fImpl;
- fImpl = nullptr;
+ if (fImpl != nullptr) {
+ delete fImpl;
+ fImpl = nullptr;
+ }
}
int32_t MeasureUnit::getOffset() const {