X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fmain.h;h=21bb4c8a0bc7f798886227184c661b352bfd40be;hp=f2350cfc7b5a9ba1315378d20de9ee4f63f2c44b;hb=3b36da6d277c6f5ad671343e724e0336ce55c893;hpb=087fc28f7d4e82a0b79dabbaa19358e48d3084fe diff --git a/src/main.h b/src/main.h index f2350cf..21bb4c8 100644 --- a/src/main.h +++ b/src/main.h @@ -607,7 +607,13 @@ public: // Read transaction if (fseek(filein, pos.nTxPos, SEEK_SET) != 0) return error("CTransaction::ReadFromDisk() : fseek failed"); - filein >> *this; + + try { + filein >> *this; + } + catch (std::exception &e) { + return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__); + } // Return file pointer if (pfileRet) @@ -1003,7 +1009,12 @@ public: filein.nType |= SER_BLOCKHEADERONLY; // Read block - filein >> *this; + try { + filein >> *this; + } + catch (std::exception &e) { + return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__); + } // Check the header if (!CheckProofOfWork(GetHash(), nBits))