Merge pull request #894 from ssakash/coverity_fix

Coverity: Prevent NULL dereferences and other stuffs.
This commit is contained in:
Gregory Hainaut 2015-10-17 16:00:28 +02:00
commit 1c8f8a00b8
4 changed files with 7 additions and 6 deletions

View File

@ -392,6 +392,7 @@ void CBreakPoints::Update(u32 addr)
if (resume)
r5900Debug.resumeCpu();
wxGetApp().GetDisassemblyPtr()->update();
auto disassembly_window = wxGetApp().GetDisassemblyPtr();
if (disassembly_window) // make sure that valid pointer is recieved to prevent potential NULL dereference.
disassembly_window->update();
}

View File

@ -514,7 +514,7 @@ public:
GSFrame* GetGsFramePtr() const { return (GSFrame*)wxWindow::FindWindowById( m_id_GsFrame ); }
MainEmuFrame* GetMainFramePtr() const { return (MainEmuFrame*)wxWindow::FindWindowById( m_id_MainFrame ); }
DisassemblyDialog* GetDisassemblyPtr() const { return m_id_Disassembler ? (DisassemblyDialog*)wxWindow::FindWindowById( m_id_Disassembler ) : NULL; }
DisassemblyDialog* GetDisassemblyPtr() const { return (DisassemblyDialog*)wxWindow::FindWindowById(m_id_Disassembler); }
void enterDebugMode();
void leaveDebugMode();

View File

@ -125,7 +125,7 @@ public:
KEY key = i->first;
ActivePtr* p = i->second;
if(p->frames > 0)
if(p->frames && ttpf)
{
uint64 tpp = p->actual > 0 ? p->ticks / p->actual : 0;
uint64 tpf = p->frames > 0 ? p->ticks / p->frames : 0;

View File

@ -1572,12 +1572,12 @@ void GSRendererSW::SharedData::UsePages(const uint32* fb_pages, int fpsm, const
{
//TransactionScope scope(s_lock);
if(global.sel.fb)
if(global.sel.fb && fb_pages != NULL)
{
m_parent->UsePages(fb_pages, 0);
}
if(global.sel.zb)
if(global.sel.zb && zb_pages != NULL)
{
m_parent->UsePages(zb_pages, 1);
}