From 06f7d02038b33dc4095112052704c27b152ab457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nick=20Lepp=C3=A4nen=20Larsson?= Date: Sat, 25 Aug 2012 15:14:59 +0200 Subject: [PATCH] [UnrarXLib] check validity of ui ptr before access Check that pExtract->GetDataIO().m_pDlgProgress is not invalid before accessing it. --- lib/UnrarXLib/rar.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/UnrarXLib/rar.cpp b/lib/UnrarXLib/rar.cpp index 7fe29370ba0e7..1b5ad04345cf3 100644 --- a/lib/UnrarXLib/rar.cpp +++ b/lib/UnrarXLib/rar.cpp @@ -203,9 +203,12 @@ int urarlib_get(char *rarfile, char *targetPath, char *fileToExtract, char *libp if (bShowProgress) { pExtract->GetDataIO().m_pDlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); - pExtract->GetDataIO().m_pDlgProgress->SetHeading(fileToExtract); - pExtract->GetDataIO().m_pDlgProgress->SetCanCancel(false); - pExtract->GetDataIO().m_pDlgProgress->StartModal(); + if (pExtract->GetDataIO().m_pDlgProgress) + { + pExtract->GetDataIO().m_pDlgProgress->SetHeading(fileToExtract); + pExtract->GetDataIO().m_pDlgProgress->SetCanCancel(false); + pExtract->GetDataIO().m_pDlgProgress->StartModal(); + } } int64_t iOff=0; @@ -234,7 +237,8 @@ int urarlib_get(char *rarfile, char *targetPath, char *fileToExtract, char *libp if (pExtract->GetDataIO().bQuit) { - pExtract->GetDataIO().m_pDlgProgress->Close(); + if (pExtract->GetDataIO().m_pDlgProgress) + pExtract->GetDataIO().m_pDlgProgress->Close(); bRes = 2; break; } @@ -269,7 +273,8 @@ int urarlib_get(char *rarfile, char *targetPath, char *fileToExtract, char *libp pExtract->GetDataIO().m_pDlgProgress->ShowProgressBar(false); } if (bShowProgress) - pExtract->GetDataIO().m_pDlgProgress->Close(); + if (pExtract->GetDataIO().m_pDlgProgress) + pExtract->GetDataIO().m_pDlgProgress->Close(); } } }