Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
Prevent possible NULL pointer dereferences.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Hill committed Sep 1, 2012
1 parent 1de4ec8 commit 7ff9e0c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
23 changes: 17 additions & 6 deletions xbmc/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1837,16 +1837,24 @@ void CApplication::ReloadSkin()
m_skinReloading = false;
CGUIMessage msg(GUI_MSG_LOAD_SKIN, -1, g_windowManager.GetActiveWindow());
g_windowManager.SendMessage(msg);

// Reload the skin, restoring the previously focused control. We need this as
// the window unload will reset all control states.
int iCtrlID = -1;
CGUIWindow* pWindow = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
int iCtrlID = pWindow->GetFocusedControlID();
if (pWindow)
iCtrlID = pWindow->GetFocusedControlID();

g_application.LoadSkin(g_guiSettings.GetString("lookandfeel.skin"));
pWindow = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
if (pWindow && pWindow->HasSaveLastControl())

if (iCtrlID != -1)
{
CGUIMessage msg3(GUI_MSG_SETFOCUS, g_windowManager.GetActiveWindow(), iCtrlID, 0);
pWindow->OnMessage(msg3);
pWindow = g_windowManager.GetWindow(g_windowManager.GetActiveWindow());
if (pWindow && pWindow->HasSaveLastControl())
{
CGUIMessage msg3(GUI_MSG_SETFOCUS, g_windowManager.GetActiveWindow(), iCtrlID, 0);
pWindow->OnMessage(msg3);
}
}
}

Expand Down Expand Up @@ -4674,7 +4682,10 @@ bool CApplication::WakeUpScreenSaver(bool bPowerOffKeyPressed /* = false */)
{
m_iScreenSaveLock = 2;
CGUIMessage msg(GUI_MSG_CHECK_LOCK,0,0);
g_windowManager.GetWindow(WINDOW_SCREENSAVER)->OnMessage(msg);

CGUIWindow* pWindow = g_windowManager.GetWindow(WINDOW_SCREENSAVER);
if (pWindow)
pWindow->OnMessage(msg);
}
if (m_iScreenSaveLock == -1)
{
Expand Down
1 change: 1 addition & 0 deletions xbmc/GUIInfoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3927,6 +3927,7 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
case LISTITEM_DIRECTOR:
if (item->HasVideoInfoTag())
return StringUtils::Join(item->GetVideoInfoTag()->m_director, g_advancedSettings.m_videoItemSeparator);
break;
case LISTITEM_ALBUM:
if (item->HasVideoInfoTag())
return item->GetVideoInfoTag()->m_strAlbum;
Expand Down

0 comments on commit 7ff9e0c

Please sign in to comment.