Browse Source

also check if _orig is empty. without this, place() is never run because isEmpty() does not return true for uninitialize (null) results.

cl-refactor
subtly 11 years ago
parent
commit
490d4bc5f1
  1. 4
      libethereum/TrieDB.h

4
libethereum/TrieDB.h

@ -456,7 +456,7 @@ template <class DB> bytes GenericTrieDB<DB>::mergeAt(RLP const& _orig, NibbleSli
// We will take care to ensure that (our reference to) _orig is killed. // We will take care to ensure that (our reference to) _orig is killed.
// Empty - just insert here // Empty - just insert here
if (_orig.isEmpty()) if (_orig.isEmpty() || _orig.isNull())
return place(_orig, _k, _v); return place(_orig, _k, _v);
assert(_orig.isList() && (_orig.itemCount() == 2 || _orig.itemCount() == 17)); assert(_orig.isList() && (_orig.itemCount() == 2 || _orig.itemCount() == 17));
@ -665,7 +665,7 @@ template <class DB> bytes GenericTrieDB<DB>::place(RLP const& _orig, NibbleSlice
// ::operator<<(std::cout << "place ", _orig) << ", " << _k << ", " << _s.toString() << std::endl; // ::operator<<(std::cout << "place ", _orig) << ", " << _k << ", " << _s.toString() << std::endl;
killNode(_orig); killNode(_orig);
if (_orig.isEmpty()) if (_orig.isEmpty() || _orig.isNull())
return RLPStream(2).appendString(hexPrefixEncode(_k, true)).appendString(_s).out(); return RLPStream(2).appendString(hexPrefixEncode(_k, true)).appendString(_s).out();
assert(_orig.isList() && (_orig.itemCount() == 2 || _orig.itemCount() == 17)); assert(_orig.isList() && (_orig.itemCount() == 2 || _orig.itemCount() == 17));

Loading…
Cancel
Save