cellSaveData/overlays/Qt: fix some warnings and a possible nullptr deref

This commit is contained in:
Megamouse 2019-07-13 21:35:36 +02:00
parent ec9b896fbf
commit b3c1759853
4 changed files with 11 additions and 13 deletions

View File

@ -160,7 +160,7 @@ static bool savedata_check_args(u32 operation, u32 version, vm::cptr<char> dirNa
}
if ((operation >= SAVEDATA_OP_LIST_AUTO_SAVE && operation <= SAVEDATA_OP_FIXED_LOAD) || operation == SAVEDATA_OP_FIXED_DELETE)
{
{
if (setBuf->dirListMax > CELL_SAVEDATA_DIRLIST_MAX)
{
// ****** sysutil savedata parameter error : 8 ******
@ -330,8 +330,6 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
save_entry2.subtitle = psf.at("SUB_TITLE").as_string();
save_entry2.details = psf.at("DETAIL").as_string();
save_entry2.size = 0;
for (const auto entry2 : fs::dir(base_dir + entry.name))
{
save_entry2.size += entry2.size;

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <Emu/Memory/vm_ptr.h>
@ -297,12 +297,12 @@ struct SaveDataEntry
std::string title;
std::string subtitle;
std::string details;
u64 size;
s64 atime;
s64 mtime;
s64 ctime;
u64 size{0};
s64 atime{0};
s64 mtime{0};
s64 ctime{0};
std::vector<uchar> iconBuf;
bool isNew;
bool isNew{false};
};
class SaveDialogBase

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "overlays.h"
namespace rsx
@ -179,7 +179,7 @@ namespace rsx
m_description->set_text("Save");
}
const bool newpos_head = listSet->newData && listSet->newData->iconPosition == CELL_SAVEDATA_ICONPOS_HEAD;
const bool newpos_head = listSet && listSet->newData && listSet->newData->iconPosition == CELL_SAVEDATA_ICONPOS_HEAD;
if (!newpos_head)
{
@ -189,7 +189,7 @@ namespace rsx
}
}
if (listSet->newData)
if (listSet && listSet->newData)
{
std::unique_ptr<overlay_element> new_stub;

View File

@ -59,7 +59,7 @@ save_data_list_dialog::save_data_list_dialog(const std::vector<SaveDataEntry>& e
UpdateSelectionLabel();
}
if (listSet->newData)
if (listSet && listSet->newData)
{
QPushButton *saveNewEntry = new QPushButton(tr("Save New Entry"), this);
connect(saveNewEntry, &QAbstractButton::clicked, this, [&]()