mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 09:35:39 +00:00
(Windows) Fixed an issue where the media viewer could crash if attempting to display corrupt or invalid PDF game manuals
This commit is contained in:
parent
73522bcb6c
commit
60f0f64b57
|
@ -244,9 +244,6 @@ bool PDFViewer::getDocumentInfo()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close process and thread handles.
|
|
||||||
CloseHandle(pi.hProcess);
|
|
||||||
CloseHandle(pi.hThread);
|
|
||||||
CloseHandle(childStdoutWrite);
|
CloseHandle(childStdoutWrite);
|
||||||
|
|
||||||
std::array<char, 512> buffer {};
|
std::array<char, 512> buffer {};
|
||||||
|
@ -268,6 +265,18 @@ bool PDFViewer::getDocumentInfo()
|
||||||
CloseHandle(childStdoutRead);
|
CloseHandle(childStdoutRead);
|
||||||
WaitForSingleObject(pi.hThread, INFINITE);
|
WaitForSingleObject(pi.hThread, INFINITE);
|
||||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||||
|
|
||||||
|
DWORD exitCode {0};
|
||||||
|
if (GetExitCodeProcess(pi.hProcess, &exitCode) && exitCode != 0) {
|
||||||
|
LOG(LogError) << "Couldn't read PDF document information";
|
||||||
|
CloseHandle(pi.hProcess);
|
||||||
|
CloseHandle(pi.hThread);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close process and thread handles.
|
||||||
|
CloseHandle(pi.hProcess);
|
||||||
|
CloseHandle(pi.hThread);
|
||||||
#else
|
#else
|
||||||
FILE* commandPipe;
|
FILE* commandPipe;
|
||||||
std::array<char, 512> buffer {};
|
std::array<char, 512> buffer {};
|
||||||
|
|
Loading…
Reference in a new issue