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
commit b3c1759853
4 changed files with 11 additions and 13 deletions

View file

@ -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.subtitle = psf.at("SUB_TITLE").as_string();
save_entry2.details = psf.at("DETAIL").as_string(); save_entry2.details = psf.at("DETAIL").as_string();
save_entry2.size = 0;
for (const auto entry2 : fs::dir(base_dir + entry.name)) for (const auto entry2 : fs::dir(base_dir + entry.name))
{ {
save_entry2.size += entry2.size; save_entry2.size += entry2.size;

View file

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

View file

@ -1,4 +1,4 @@
#include "stdafx.h" #include "stdafx.h"
#include "overlays.h" #include "overlays.h"
namespace rsx namespace rsx
@ -179,7 +179,7 @@ namespace rsx
m_description->set_text("Save"); 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) if (!newpos_head)
{ {
@ -189,7 +189,7 @@ namespace rsx
} }
} }
if (listSet->newData) if (listSet && listSet->newData)
{ {
std::unique_ptr<overlay_element> new_stub; 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(); UpdateSelectionLabel();
} }
if (listSet->newData) if (listSet && listSet->newData)
{ {
QPushButton *saveNewEntry = new QPushButton(tr("Save New Entry"), this); QPushButton *saveNewEntry = new QPushButton(tr("Save New Entry"), this);
connect(saveNewEntry, &QAbstractButton::clicked, this, [&]() connect(saveNewEntry, &QAbstractButton::clicked, this, [&]()