Extra check when opening pup file
This commit is contained in:
@@ -1,9 +1,15 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include "PUP.h"
|
#include "PUP.h"
|
||||||
|
|
||||||
pup_object::pup_object(const fs::file& file): m_file(file)
|
pup_object::pup_object(const fs::file& file): m_file(file)
|
||||||
{
|
{
|
||||||
|
if (!file)
|
||||||
|
{
|
||||||
|
isValid = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PUPHeader m_header;
|
PUPHeader m_header;
|
||||||
m_file.read(m_header);
|
m_file.read(m_header);
|
||||||
if (m_header.magic != "SCEUF\0\0\0"_u64)
|
if (m_header.magic != "SCEUF\0\0\0"_u64)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@@ -532,6 +532,13 @@ void main_window::InstallPup(const QString& dropPath)
|
|||||||
const std::string path = sstr(filePath);
|
const std::string path = sstr(filePath);
|
||||||
|
|
||||||
fs::file pup_f(path);
|
fs::file pup_f(path);
|
||||||
|
if (!pup_f)
|
||||||
|
{
|
||||||
|
LOG_ERROR(GENERAL, "Error opening PUP file %s", path);
|
||||||
|
QMessageBox::critical(this, tr("Failure!"), tr("The selected firmware file couldn't be opened."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pup_object pup(pup_f);
|
pup_object pup(pup_f);
|
||||||
if (!pup)
|
if (!pup)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user