ICU-6132 Check for null pointer dereferencing in operator =.

X-SVN-Rev: 23243
This commit is contained in:
Michael Ow 2008-01-16 17:00:55 +00:00
parent 12751de177
commit 9dc2844cfb

View File

@ -1,6 +1,6 @@
/* /*
********************************************************************** **********************************************************************
* Copyright (C) 2001-2006 IBM and others. All rights reserved. * Copyright (C) 2001-2008 IBM and others. All rights reserved.
********************************************************************** **********************************************************************
* Date Name Description * Date Name Description
* 03/22/2000 helena Creation. * 03/22/2000 helena Creation.
@ -220,9 +220,12 @@ StringSearch & StringSearch::operator=(const StringSearch &that)
m_text_.length(), m_text_.length(),
that.m_strsrch_->collator, that.m_strsrch_->collator,
NULL, &status); NULL, &status);
// Alias the collator // Check null pointer
m_collator_.setUCollator((UCollator *)m_strsrch_->collator); if (m_strsrch_ != NULL) {
m_search_ = m_strsrch_->search; // Alias the collator
m_collator_.setUCollator((UCollator *)m_strsrch_->collator);
m_search_ = m_strsrch_->search;
}
} }
return *this; return *this;
} }