Possible workaround for crash

This commit is contained in:
jl777
2018-07-17 05:26:34 -11:00
parent 17839698a3
commit 7000ef1af3

View File

@@ -1885,6 +1885,11 @@ void CWallet::ReacceptWalletTransactions()
bool CWalletTx::RelayWalletTransaction() bool CWalletTx::RelayWalletTransaction()
{ {
if ( pwallet == 0 )
{
fprintf(stderr,"unexpected null pwallet in RelayWalletTransaction\n");
return(false);
}
assert(pwallet->GetBroadcastTransactions()); assert(pwallet->GetBroadcastTransactions());
if (!IsCoinBase()) if (!IsCoinBase())
{ {
@@ -2124,9 +2129,13 @@ std::vector<uint256> CWallet::ResendWalletTransactionsBefore(int64_t nTime)
} }
BOOST_FOREACH(PAIRTYPE(const unsigned int, CWalletTx*)& item, mapSorted) BOOST_FOREACH(PAIRTYPE(const unsigned int, CWalletTx*)& item, mapSorted)
{ {
CWalletTx& wtx = *item.second; CWalletTx& wtx;
if (wtx.RelayWalletTransaction()) if ( item.second != 0 )
result.push_back(wtx.GetHash()); {
wtx = *item.second;
if (wtx.RelayWalletTransaction())
result.push_back(wtx.GetHash());
}
} }
return result; return result;
} }