diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-10-29 11:35:48 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-10-29 11:35:48 +0200 |
commit | 83b05117310334cc000cbdeaeae6be57622f4fab (patch) | |
tree | 16f6c25e946b24455a951a29f31f376e3e47bdf5 /src/wallet/api/wallet_manager.cpp | |
parent | Merge pull request #1269 (diff) | |
parent | Wallet API: make sure path exists before searching for wallets (diff) | |
download | monero-83b05117310334cc000cbdeaeae6be57622f4fab.tar.xz |
Merge pull request #1270
fdef09f Wallet API: make sure path exists before searching for wallets (Jacob Brydolf)
Diffstat (limited to 'src/wallet/api/wallet_manager.cpp')
-rw-r--r-- | src/wallet/api/wallet_manager.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wallet/api/wallet_manager.cpp b/src/wallet/api/wallet_manager.cpp index aa99476ee..b8500aae3 100644 --- a/src/wallet/api/wallet_manager.cpp +++ b/src/wallet/api/wallet_manager.cpp @@ -88,10 +88,13 @@ bool WalletManagerImpl::walletExists(const std::string &path) std::vector<std::string> WalletManagerImpl::findWallets(const std::string &path) { std::vector<std::string> result; + boost::filesystem::path work_dir(path); + // return empty result if path doesn't exist + if(!boost::filesystem::is_directory(path)){ + return result; + } const boost::regex wallet_rx("(.*)\\.(keys)$"); // searching for <wallet_name>.keys files boost::filesystem::recursive_directory_iterator end_itr; // Default ctor yields past-the-end - boost::filesystem::path work_dir(path); - for (boost::filesystem::recursive_directory_iterator itr(path); itr != end_itr; ++itr) { // Skip if not a file if (!boost::filesystem::is_regular_file(itr->status())) |