@@ -210,6 +210,15 @@ void SendWidget::sendClicked() {
210210 }
211211
212212 if (currency != " XMR" && !sendAll) {
213+ if (!appData ()->prices .canConvert (currency, " XMR" )) {
214+ Utils::showError (this , " Unable to create transaction" ,
215+ QString (" No exchange rates were received, so the amount in %1 can't be converted to XMR." ).arg (currency),
216+ {" Enter the amount in XMR instead, or" ,
217+ " Wait for exchange rates to be received, then try again." },
218+ " send_transaction" , " Amount field" );
219+ return ;
220+ }
221+
213222 // Convert fiat amount to XMR, but only if we're not sending the entire balance
214223 amount = WalletManager::amountFromDouble (this ->conversionAmount ());
215224 }
@@ -287,13 +296,18 @@ void SendWidget::updateConversionLabel() {
287296 return ;
288297 }
289298
290- QString conversionAmountStr = [this ]{
291- QString currency = ui->comboCurrencySelection ->currentText ();
299+ QString currency = ui->comboCurrencySelection ->currentText ();
300+ auto preferredFiatCurrency = conf ()->get (Config::preferredFiatCurrency).toString ();
301+ if (!appData ()->prices .canConvert (currency, currency != " XMR" ? " XMR" : preferredFiatCurrency)) {
302+ ui->label_conversionAmount ->hide ();
303+ return ;
304+ }
305+
306+ QString conversionAmountStr = [this , ¤cy, &preferredFiatCurrency]{
292307 if (currency != " XMR" ) {
293308 return QString (" ~%1 XMR" ).arg (QString::number (this ->conversionAmount (), ' f' ));
294309
295310 } else {
296- auto preferredFiatCurrency = conf ()->get (Config::preferredFiatCurrency).toString ();
297311 double conversionAmount = appData ()->prices .convert (" XMR" , preferredFiatCurrency, this ->amountDouble ());
298312 return QString (" ~%1 %2" ).arg (QString::number (conversionAmount, ' f' , 2 ), preferredFiatCurrency);
299313 }
0 commit comments