From 32f051a248617409abadbcfe2ffeec6c4192d5fb Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 24 Dec 2008 09:27:36 -0500 Subject: CoinListItem cost should not be zero; added checks --- sigmod/CoinListItem.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sigmod/CoinListItem.cpp') diff --git a/sigmod/CoinListItem.cpp b/sigmod/CoinListItem.cpp index f531f3a1..f68d3daf 100644 --- a/sigmod/CoinListItem.cpp +++ b/sigmod/CoinListItem.cpp @@ -34,7 +34,7 @@ Sigmod::CoinListItem::CoinListItem(const CoinListItem& item) : Sigmod::CoinListItem::CoinListItem(const CoinList* parent, const int id) : Object(parent, id), m_type(Item), - m_object(INT_MAX), + m_object(-1), m_cost(0) { } @@ -56,6 +56,7 @@ void Sigmod::CoinListItem::validate() { TEST_BEGIN(); TEST(setObject, object); + TEST(setCost, cost); TEST_END(); } @@ -91,7 +92,10 @@ void Sigmod::CoinListItem::setObject(const int object) void Sigmod::CoinListItem::setCost(const int cost) { - CHECK(cost); + if (!cost) + emit(error(bounds("cost"))); + else + CHECK(cost); } Sigmod::CoinListItem::Type Sigmod::CoinListItem::type() const -- cgit