From 0d99a3de3f3b9d0d3b11153f05efa17327a233d8 Mon Sep 17 00:00:00 2001 From: peak3d Date: Fri, 19 Apr 2019 16:01:52 +0200 Subject: [PATCH] Fix / secure 2 code places --- xbmc/dialogs/GUIDialogMediaSource.cpp | 6 +++--- xbmc/messaging/ApplicationMessenger.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/xbmc/dialogs/GUIDialogMediaSource.cpp b/xbmc/dialogs/GUIDialogMediaSource.cpp index e4ccc8fdb3b66..86fae937041d4 100644 --- a/xbmc/dialogs/GUIDialogMediaSource.cpp +++ b/xbmc/dialogs/GUIDialogMediaSource.cpp @@ -417,12 +417,12 @@ void CGUIDialogMediaSource::OnPathBrowse(int item) void CGUIDialogMediaSource::OnPath(int item) { - if (item < 0 || item > m_paths->Size()) return; + if (item < 0 || item >= m_paths->Size()) return; - if (m_name != CUtil::GetTitleFromPath(m_paths->Get(item)->GetPath())) + std::string path(m_paths->Get(item)->GetPath()); + if (m_name != CUtil::GetTitleFromPath(path)) m_bNameChanged = true; - std::string path(m_paths->Get(item)->GetPath()); CGUIKeyboardFactory::ShowAndGetInput(path, CVariant{ g_localizeStrings.Get(1021) }, false); m_paths->Get(item)->SetPath(path); diff --git a/xbmc/messaging/ApplicationMessenger.cpp b/xbmc/messaging/ApplicationMessenger.cpp index d0f60aede3c70..6414279d36958 100644 --- a/xbmc/messaging/ApplicationMessenger.cpp +++ b/xbmc/messaging/ApplicationMessenger.cpp @@ -136,8 +136,12 @@ int CApplicationMessenger::SendMsg(ThreadMessage&& message, bool wait) // waitEvent ... just for such contingencies :) { // ensure the thread doesn't hold the graphics lock - CSingleExit exit(CServiceBroker::GetWinSystem()->GetGfxContext()); - waitEvent->Wait(); + CWinSystemBase* winSystem = CServiceBroker::GetWinSystem(); + if (winSystem) + { + CSingleExit exit(winSystem->GetGfxContext()); + waitEvent->Wait(); + } return *result; }