1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-17 01:10:10 +00:00

Avoid issues with saved games that have no screenshot data

This commit is contained in:
Alexei Kotov 2022-09-02 07:04:02 +03:00
parent 20186fd2c2
commit a8e561d885
2 changed files with 8 additions and 2 deletions

View File

@ -430,7 +430,13 @@ namespace MWGui
// Decode screenshot
const std::vector<char>& data = mCurrentSlot->mProfile.mScreenshot;
Files::IMemStream instream (&data[0], data.size());
if (!data.size())
{
Log(Debug::Warning) << "Warning: Selected saved game has no savegame screenshot";
return;
}
Files::IMemStream instream (data.data(), data.size());
osgDB::ReaderWriter* readerwriter = osgDB::Registry::instance()->getReaderWriterForExtension("jpg");
if (!readerwriter)

View File

@ -50,7 +50,7 @@ void SavedGame::save (ESMWriter &esm) const
esm.writeHNString ("DEPE", *iter);
esm.startSubRecord("SCRN");
esm.write(&mScreenshot[0], mScreenshot.size());
esm.write(mScreenshot.data(), mScreenshot.size());
esm.endRecord("SCRN");
}