Index: re2/prefilter.cc =================================================================== --- a/re2/prefilter.cc +++ b/re2/prefilter.cc @@ -265,14 +265,6 @@ // Format a Info in string form. string Prefilter::Info::ToString() { - if (this == NULL) { - // Sometimes when iterating on children of a node, - // some children might have NULL Info. Adding - // the check here for NULL to take care of cases where - // the caller is not checking. - return ""; - } - if (is_exact_) { int n = 0; string s; @@ -640,7 +632,7 @@ if (Trace) { VLOG(0) << "BuildInfo " << re->ToString() - << ": " << info->ToString(); + << ": " << (info ? info->ToString() : ""); } return info; @@ -665,9 +657,6 @@ } string Prefilter::DebugString() const { - if (this == NULL) - return ""; - switch (op_) { default: LOG(DFATAL) << "Bad op in Prefilter::DebugString: " << op_; @@ -683,7 +672,8 @@ for (int i = 0; i < subs_->size(); i++) { if (i > 0) s += " "; - s += (*subs_)[i]->DebugString(); + Prefilter* sub = (*subs_)[i]; + s += sub ? sub->DebugString() : ""; } return s; } @@ -692,7 +682,8 @@ for (int i = 0; i < subs_->size(); i++) { if (i > 0) s += "|"; - s += (*subs_)[i]->DebugString(); + Prefilter* sub = (*subs_)[i]; + s += sub ? sub->DebugString() : ""; } s += ")"; return s; Index: re2/regexp.cc =================================================================== --- a/re2/regexp.cc +++ b/re2/regexp.cc @@ -873,8 +873,6 @@ } void CharClass::Delete() { - if (this == NULL) - return; uint8 *data = reinterpret_cast(this); delete[] data; }