summaryrefslogtreecommitdiff
path: root/protocols/CurrencyRates
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-06-26 16:11:39 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-06-26 16:11:39 +0300
commit0e743376ba4c30724b7d17181b0b98e0aa9a0c01 (patch)
treeaccdc4822712f2666a081f5a3305c9942a33613c /protocols/CurrencyRates
parente49ce30bcdda53ba07de8261e9ac41493faab845 (diff)
fixes #2924 (CurrencyRates: падение при конвертации)
Diffstat (limited to 'protocols/CurrencyRates')
-rw-r--r--protocols/CurrencyRates/src/CurrencyConverter.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/protocols/CurrencyRates/src/CurrencyConverter.cpp b/protocols/CurrencyRates/src/CurrencyConverter.cpp
index a129edd784..cb9f86e8b3 100644
--- a/protocols/CurrencyRates/src/CurrencyConverter.cpp
+++ b/protocols/CurrencyRates/src/CurrencyConverter.cpp
@@ -181,8 +181,15 @@ INT_PTR CALLBACK CurrencyConverterDlgProc(HWND hDlg, UINT msg, WPARAM wp, LPARAM
const auto pProvider = get_currency_converter_provider();
assert(pProvider);
if (pProvider) {
- double dResult = pProvider->Convert(dAmount, from, to);
- CMStringW sResult(FORMAT, L"%.2lf %s = %.2lf %s", dAmount, from.GetName().c_str(), dResult, to.GetName().c_str());
+ CMStringW sResult;
+
+ try {
+ double dResult = pProvider->Convert(dAmount, from, to);
+ sResult.Format(L"%.2lf %s = %.2lf %s", dAmount, from.GetName().c_str(), dResult, to.GetName().c_str());
+ }
+ catch (std::exception& e) {
+ sResult = e.what();
+ }
SetDlgItemText(hDlg, IDC_EDIT_RESULT, sResult);
}
}