From a17ca0cd4a4af440b5ec71a12d200e865e1e685f Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 1 Aug 2012 14:19:13 -0700 Subject: [PATCH] Fix the crash bug. --- src/SerializedTypes.cpp | 6 ++++++ src/SerializedTypes.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/SerializedTypes.cpp b/src/SerializedTypes.cpp index bd76f5c843..7177f0fb2c 100644 --- a/src/SerializedTypes.cpp +++ b/src/SerializedTypes.cpp @@ -208,6 +208,12 @@ void STVector256::add(Serializer& s) const s.addVL(mValue.empty() ? NULL : mValue[0].begin(), mValue.size() * (256 / 8)); } +bool STVector256::isEquivalent(const SerializedType& t) const +{ + const STVector256* v = dynamic_cast(&t); + return v && (mValue == v->mValue); +} + // // STAccount // diff --git a/src/SerializedTypes.h b/src/SerializedTypes.h index b1ce80eedb..7b8d10bebf 100644 --- a/src/SerializedTypes.h +++ b/src/SerializedTypes.h @@ -83,7 +83,7 @@ public: virtual void add(Serializer& s) const { return; } virtual bool isEquivalent(const SerializedType& t) const - { assert(getSType() == STI_NOTPRESENT); return t.getSType() == STI_NOTPRESENT; } + { std::cerr << getSType() << std::endl; assert(getSType() == STI_NOTPRESENT); return t.getSType() == STI_NOTPRESENT; } bool operator==(const SerializedType& t) const { return (getSType() == t.getSType()) && isEquivalent(t); } @@ -696,6 +696,7 @@ public: const std::vector& peekValue() const { return mValue; } std::vector& peekValue() { return mValue; } + virtual bool isEquivalent(const SerializedType& t) const; std::vector getValue() const { return mValue; }