X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fmain.h;h=241ef46c8fe03ef85aacdf74f6193143f4207c04;hp=2439572e19027b626e1a39ea64ce398e0542188b;hb=a49927a46d578d142411c52b17c6f11bb19da03d;hpb=d7534272c62583320dc8d4a1ea71a41c715ef559 diff --git a/src/main.h b/src/main.h index 2439572..241ef46 100644 --- a/src/main.h +++ b/src/main.h @@ -594,7 +594,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) @@ -976,7 +982,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))