16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 03:09:18 +02:00

minor diagnostics enhancements and null pointer safeguards

This commit is contained in:
tmj-fstate
2017-06-26 22:31:42 +02:00
parent 5d7b3fb036
commit 8e37307ff5
4 changed files with 24 additions and 13 deletions

View File

@@ -50,8 +50,13 @@ cParser::cParser( std::string const &Stream, buffertype const Type, std::string
// calculate stream size
if (mStream)
{
mSize = mStream->rdbuf()->pubseekoff(0, std::ios_base::end);
mStream->rdbuf()->pubseekoff(0, std::ios_base::beg);
if( true == mStream->fail() ) {
ErrorLog( "Failed to open file \"" + Path + "\"" );
}
else {
mSize = mStream->rdbuf()->pubseekoff( 0, std::ios_base::end );
mStream->rdbuf()->pubseekoff( 0, std::ios_base::beg );
}
}
else
mSize = 0;