Avoid a crash when a bad video stream is specified.

This commit is contained in:
Unknown W. Brackets 2013-08-29 00:41:22 -07:00
parent f20663e530
commit bbe13f1d74

View File

@ -15,8 +15,9 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "MediaEngine.h"
#include "../MemMap.h"
#include "Core/HW/MediaEngine.h"
#include "Core/MemMap.h"
#include "Core/Reporting.h"
#include "GPU/GPUInterface.h"
#include "Core/HW/atrac3plus.h"
@ -221,6 +222,11 @@ bool MediaEngine::openContext() {
if(avformat_find_stream_info(m_pFormatCtx, NULL) < 0)
return false;
if (m_videoStream >= (int)m_pFormatCtx->nb_streams) {
WARN_LOG_REPORT(ME, "Bad video stream %d", m_videoStream);
m_videoStream = -1;
}
if (m_videoStream == -1) {
// Find the first video stream
for(int i = 0; i < (int)m_pFormatCtx->nb_streams; i++) {