Avoid issues with saved games that have no screenshot data

crashfix_debugdraw
Alexei Kotov 2 years ago
parent 20186fd2c2
commit a8e561d885

@ -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)

@ -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");
}

Loading…
Cancel
Save