Skip to content

Commit

Permalink
Merge bitcoin#11508: Fix crash via division by zero assertion
Browse files Browse the repository at this point in the history
207408b Fix crash via division by zero assertion (Jonas Schnelli)

Pull request description:

  Replaces the newly added `assert` for a devision by zero protection by a control structure. Floating point division by zero is defined by the floating point standard and results in +inf or -inf.

  Introduced in bitcoin#11133
  Reported by @mzhou, fixes bitcoin#11501

Tree-SHA512: ac9b4efa3ba52a2aa246fb11170128c4aaf829fd491b649524c85069c6ed33ae612e761809aea9d9a44bdea29a417b3f3a558226495094b5070a42a56b2ac77e
  • Loading branch information
laanwj authored and PastaPastaPasta committed Jan 12, 2020
1 parent e1575f9 commit 16e8ca6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/qt/coincontroldialog.cpp
Expand Up @@ -628,8 +628,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
QString toolTipDust = tr("This label turns red if any recipient receives an amount smaller than the current dust threshold.");

// how many satoshis the estimated fee can vary per byte we guess wrong
assert(nBytes != 0);
double dFeeVary = (double)nPayFee / nBytes;
double dFeeVary = (nBytes != 0) ? (double)nPayFee / nBytes : 0;

QString toolTip4 = tr("Can vary +/- %1 duff(s) per input.").arg(dFeeVary);

Expand Down

0 comments on commit 16e8ca6

Please sign in to comment.