mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-17 03:09:47 +12:00
fix potential nullptrs and off by one
This commit is contained in:
parent
cd25e11f8e
commit
68e35d806a
2 changed files with 2 additions and 2 deletions
|
@ -246,7 +246,7 @@ Rust::Result<std::vector<u8>, HorizonResult> ExtSaveDataArchive::loadIcon() cons
|
||||||
const fs::path iconPath = IOFile::getAppData() / backingFolder / "icon";
|
const fs::path iconPath = IOFile::getAppData() / backingFolder / "icon";
|
||||||
IOFile file(iconPath, "rb");
|
IOFile file(iconPath, "rb");
|
||||||
const s32 size = static_cast<s32>(file.size().value_or(-1));
|
const s32 size = static_cast<s32>(file.size().value_or(-1));
|
||||||
if (size < 0) {
|
if (size <= 0) {
|
||||||
return Err(Result::FS::NotFoundInvalid);
|
return Err(Result::FS::NotFoundInvalid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -578,7 +578,7 @@ void FSService::createExtSaveData(u32 messagePointer) {
|
||||||
if (selected != nullptr) {
|
if (selected != nullptr) {
|
||||||
selected->format(path, info);
|
selected->format(path, info);
|
||||||
|
|
||||||
if (smdhSize > 0) {
|
if (smdhSize > 0 && smdhPointer != 0) {
|
||||||
const FSPath smdh = readPath(PathType::Binary, smdhPointer, smdhSize);
|
const FSPath smdh = readPath(PathType::Binary, smdhPointer, smdhSize);
|
||||||
selected->saveIcon(smdh.binary);
|
selected->saveIcon(smdh.binary);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue