diff --git a/src/init.cpp b/src/init.cpp index 55670c7dc6b..b46b53ac134 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -537,9 +537,10 @@ static void BlockNotifyCallback(bool initialSync, const CBlockIndex *pBlockIndex return; std::string strCmd = gArgs.GetArg("-blocknotify", ""); - - boost::replace_all(strCmd, "%s", pBlockIndex->GetBlockHash().GetHex()); - boost::thread t(runCommand, strCmd); // thread runs free + if (!strCmd.empty()) { + boost::replace_all(strCmd, "%s", pBlockIndex->GetBlockHash().GetHex()); + boost::thread t(runCommand, strCmd); // thread runs free + } } static bool fHaveGenesis = false; diff --git a/src/util.cpp b/src/util.cpp index 4659ff73c6f..51ccc94787f 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -810,6 +810,7 @@ fs::path GetSpecialFolderPath(int nFolder, bool fCreate) void runCommand(const std::string& strCommand) { + if (strCommand.empty()) return; int nErr = ::system(strCommand.c_str()); if (nErr) LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index f14278af3dc..925b474d73c 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -962,7 +962,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose) // notify an external script when a wallet transaction comes in or is updated std::string strCmd = gArgs.GetArg("-walletnotify", ""); - if ( !strCmd.empty()) + if (!strCmd.empty()) { boost::replace_all(strCmd, "%s", wtxIn.GetHash().GetHex()); boost::thread t(runCommand, strCmd); // thread runs free