1 Index: re2/prefilter.cc 2 =================================================================== 3 --- a/re2/prefilter.cc 4 +++ b/re2/prefilter.cc 5 @@ -265,14 +265,6 @@ 6 7 // Format a Info in string form. 8 string Prefilter::Info::ToString() { 9 - if (this == NULL) { 10 - // Sometimes when iterating on children of a node, 11 - // some children might have NULL Info. Adding 12 - // the check here for NULL to take care of cases where 13 - // the caller is not checking. 14 - return ""; 15 - } 16 - 17 if (is_exact_) { 18 int n = 0; 19 string s; 20 @@ -640,7 +632,7 @@ 21 22 if (Trace) { 23 VLOG(0) << "BuildInfo " << re->ToString() 24 - << ": " << info->ToString(); 25 + << ": " << (info ? info->ToString() : ""); 26 } 27 28 return info; 29 @@ -665,9 +657,6 @@ 30 } 31 32 string Prefilter::DebugString() const { 33 - if (this == NULL) 34 - return "<nil>"; 35 - 36 switch (op_) { 37 default: 38 LOG(DFATAL) << "Bad op in Prefilter::DebugString: " << op_; 39 @@ -683,7 +672,8 @@ 40 for (int i = 0; i < subs_->size(); i++) { 41 if (i > 0) 42 s += " "; 43 - s += (*subs_)[i]->DebugString(); 44 + Prefilter* sub = (*subs_)[i]; 45 + s += sub ? sub->DebugString() : "<nil>"; 46 } 47 return s; 48 } 49 @@ -692,7 +682,8 @@ 50 for (int i = 0; i < subs_->size(); i++) { 51 if (i > 0) 52 s += "|"; 53 - s += (*subs_)[i]->DebugString(); 54 + Prefilter* sub = (*subs_)[i]; 55 + s += sub ? sub->DebugString() : "<nil>"; 56 } 57 s += ")"; 58 return s; 59 Index: re2/regexp.cc 60 =================================================================== 61 --- a/re2/regexp.cc 62 +++ b/re2/regexp.cc 63 @@ -873,8 +873,6 @@ 64 } 65 66 void CharClass::Delete() { 67 - if (this == NULL) 68 - return; 69 uint8 *data = reinterpret_cast<uint8*>(this); 70 delete[] data; 71 }