Merge pull request #1881 from xanatos/Tests

Removed a duplicated identical if
This commit is contained in:
Wladimir J. van der Laan 2012-09-29 01:00:55 -07:00
commit f72fd0e792

View File

@ -64,10 +64,9 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
{ {
strHTML += "<b>" + tr("Source") + ":</b> " + tr("Generated") + "<br>"; strHTML += "<b>" + tr("Source") + ":</b> " + tr("Generated") + "<br>";
} }
else if (!wtx.mapValue["from"].empty()) else if (wtx.mapValue.count("from") && !wtx.mapValue["from"].empty())
{ {
// Online transaction // Online transaction
if (!wtx.mapValue["from"].empty())
strHTML += "<b>" + tr("From") + ":</b> " + GUIUtil::HtmlEscape(wtx.mapValue["from"]) + "<br>"; strHTML += "<b>" + tr("From") + ":</b> " + GUIUtil::HtmlEscape(wtx.mapValue["from"]) + "<br>";
} }
else else
@ -104,7 +103,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
// //
// To // To
// //
if (!wtx.mapValue["to"].empty()) if (wtx.mapValue.count("to") && !wtx.mapValue["to"].empty())
{ {
// Online transaction // Online transaction
std::string strAddress = wtx.mapValue["to"]; std::string strAddress = wtx.mapValue["to"];
@ -160,7 +159,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
if (wallet->IsMine(txout)) if (wallet->IsMine(txout))
continue; continue;
if (wtx.mapValue["to"].empty()) if (!wtx.mapValue.count("to") || wtx.mapValue["to"].empty())
{ {
// Offline transaction // Offline transaction
CTxDestination address; CTxDestination address;
@ -209,9 +208,9 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
// //
// Message // Message
// //
if (!wtx.mapValue["message"].empty()) if (wtx.mapValue.count("message") && !wtx.mapValue["message"].empty())
strHTML += "<br><b>" + tr("Message") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["message"], true) + "<br>"; strHTML += "<br><b>" + tr("Message") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["message"], true) + "<br>";
if (!wtx.mapValue["comment"].empty()) if (wtx.mapValue.count("comment") && !wtx.mapValue["comment"].empty())
strHTML += "<br><b>" + tr("Comment") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["comment"], true) + "<br>"; strHTML += "<br><b>" + tr("Comment") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["comment"], true) + "<br>";
strHTML += "<b>" + tr("Transaction ID") + ":</b> " + wtx.GetHash().ToString().c_str() + "<br>"; strHTML += "<b>" + tr("Transaction ID") + ":</b> " + wtx.GetHash().ToString().c_str() + "<br>";