Browse Source

[2372] catch a buggy case of bogus ID in State::getInstance

JINMEI Tatuya 12 years ago
parent
commit
a3dde49a82
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/lib/dns/master_lexer.cc

+ 6 - 0
src/lib/dns/master_lexer.cc

@@ -218,6 +218,12 @@ State::getInstance(ID state_id) {
     case String:
         return (STRING_STATE);
     }
+
+    // This is a bug of the caller, and this method is only expected to be
+    // used by tests, so we just forcefully make it fail by asserting the
+    // condition.
+    assert(false);
+    return (STRING_STATE); // a dummy return, to silence some compilers.
 }
 
 const State*