X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fmain.h;h=48877f976ad6996bcd69f4731250ad0a18b00e69;hb=d67b0434f24a629372000b0bd573ea9013ca3d90;hp=be67fbf82c1a58d3d55aa8bd459c8c958d217966;hpb=d11488abd05cb39a9f481e7c4c35f780197a3d28;p=novacoin.git diff --git a/src/main.h b/src/main.h index be67fbf..48877f9 100644 --- a/src/main.h +++ b/src/main.h @@ -601,7 +601,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) @@ -987,7 +993,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))