aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-09-30 21:43:57 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-09-30 21:43:57 +0300
commit0019e3106bffcdb269af56de13ecababe545b395 (patch)
tree9a072bc8e3e56508b763897d0c1ff112d77349b7 /src/wallet
parentlibwallet_api: fast-refresh for new wallet (diff)
downloadmonero-0019e3106bffcdb269af56de13ecababe545b395.tar.xz
libwallet_api: fix unhandled exception on address check
Diffstat (limited to '')
-rw-r--r--src/wallet/api/utils.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/wallet/api/utils.cpp b/src/wallet/api/utils.cpp
index aa85323f0..1bf35197c 100644
--- a/src/wallet/api/utils.cpp
+++ b/src/wallet/api/utils.cpp
@@ -56,18 +56,22 @@ bool isAddressLocal(const std::string &address)
LOG_PRINT_L1("Failed to determine whether daemon is local, assuming not");
return false;
}
-
- // resolve to IP
- boost::asio::io_service io_service;
- boost::asio::ip::tcp::resolver resolver(io_service);
- boost::asio::ip::tcp::resolver::query query(u_c.host, "");
- boost::asio::ip::tcp::resolver::iterator i = resolver.resolve(query);
- while (i != boost::asio::ip::tcp::resolver::iterator())
- {
- const boost::asio::ip::tcp::endpoint &ep = *i;
- if (ep.address().is_loopback())
- return true;
- ++i;
+ // resolver::resolve can throw an exception
+ try {
+ // resolve to IP
+ boost::asio::io_service io_service;
+ boost::asio::ip::tcp::resolver resolver(io_service);
+ boost::asio::ip::tcp::resolver::query query(u_c.host, "");
+ boost::asio::ip::tcp::resolver::iterator i = resolver.resolve(query);
+ while (i != boost::asio::ip::tcp::resolver::iterator())
+ {
+ const boost::asio::ip::tcp::endpoint &ep = *i;
+ if (ep.address().is_loopback())
+ return true;
+ ++i;
+ }
+ } catch (const boost::system::system_error &e) {
+ LOG_ERROR("Failed to resolve " << address << ", :" << e.what());
}
return false;