aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortamland <thomas.amland@gmail.com>2015-02-06 11:39:44 +0100
committertamland <thomas.amland@gmail.com>2015-02-06 11:39:44 +0100
commit770ab55c46ccc8e00180a52bea22c6402598fc76 (patch)
treecfed43cc33ea19c70c1df383724a50907954ef44
parent7e9fea9ea16e410e574b14b3c0754635b2d62f7e (diff)
parentb6b3119a3b4bf9e42dc4e96f5e10492983f77b86 (diff)
Merge pull request #6284 from tamland/python_dialog_segfaults
[python] prevent segfault when calling DialogProgress(BG) methods before...
-rw-r--r--xbmc/interfaces/legacy/Dialog.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/xbmc/interfaces/legacy/Dialog.cpp b/xbmc/interfaces/legacy/Dialog.cpp
index b8884d5308..3238c3387b 100644
--- a/xbmc/interfaces/legacy/Dialog.cpp
+++ b/xbmc/interfaces/legacy/Dialog.cpp
@@ -392,10 +392,10 @@ namespace XBMCAddon
const String& line3) throw (WindowException)
{
DelayedCallGuard dcguard(languageHook);
- CGUIDialogProgress* pDialog= dlg;
+ CGUIDialogProgress* pDialog = dlg;
if (pDialog == NULL)
- throw WindowException("Error: Window is NULL, this is not possible :-)");
+ throw WindowException("Dialog not created.");
if (percent >= 0 && percent <= 100)
{
@@ -418,12 +418,16 @@ namespace XBMCAddon
void DialogProgress::close()
{
DelayedCallGuard dcguard(languageHook);
+ if (dlg == NULL)
+ throw WindowException("Dialog not created.");
dlg->Close();
open = false;
}
bool DialogProgress::iscanceled()
{
+ if (dlg == NULL)
+ throw WindowException("Dialog not created.");
return dlg->IsCanceled();
}
@@ -463,11 +467,10 @@ namespace XBMCAddon
void DialogProgressBG::update(int percent, const String& heading, const String& message) throw (WindowException)
{
DelayedCallGuard dcguard(languageHook);
- CGUIDialogExtendedProgressBar* pDialog = dlg;
CGUIDialogProgressBarHandle* pHandle = handle;
- if (pDialog == NULL)
- throw WindowException("Error: Window is NULL, this is not possible :-)");
+ if (pHandle == NULL)
+ throw WindowException("Dialog not created.");
if (percent >= 0 && percent <= 100)
pHandle->SetPercentage((float)percent);
@@ -480,12 +483,16 @@ namespace XBMCAddon
void DialogProgressBG::close()
{
DelayedCallGuard dcguard(languageHook);
+ if (handle == NULL)
+ throw WindowException("Dialog not created.");
handle->MarkFinished();
open = false;
}
bool DialogProgressBG::isFinished()
{
+ if (handle == NULL)
+ throw WindowException("Dialog not created.");
return handle->IsFinished();
}