X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fmain.h;h=44624f5cf709475704d841f60b0cea3057e63083;hb=a2de1ea2d5776289c247bbc18c1ed13e16a4169f;hp=b1c78854a11fb7996cbc07cd4d80ea99962c11f4;hpb=b6862f7b74d0ea7442cf3b9eec7b9556ca47ce4b;p=novacoin.git diff --git a/src/main.h b/src/main.h index b1c7885..44624f5 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) @@ -993,7 +999,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))