Skip to content

Commit

Permalink
[UnrarXLib] check validity of ui ptr before access
Browse files Browse the repository at this point in the history
Check that pExtract->GetDataIO().m_pDlgProgress is not invalid
before accessing it.
  • Loading branch information
frals committed Aug 25, 2012
1 parent ae00fdf commit 06f7d02
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/UnrarXLib/rar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
}
}
}
Expand Down

0 comments on commit 06f7d02

Please sign in to comment.