Permalink
Browse files

Merge pull request #4382 from jmarshallnz/fix_non_addon_scripts

[python] fix scripts run directly that aren't an add-on. fixes #14265
  • Loading branch information...
2 parents 7e0e1ac + f296c4c commit e042b6518f1e397b06b41296a6dedbc752b879ad @jmarshallnz jmarshallnz committed Mar 9, 2014
Showing with 6 additions and 5 deletions.
  1. +6 −5 xbmc/interfaces/python/LanguageHook.cpp
@@ -129,7 +129,6 @@ namespace XBMCAddon
String PythonLanguageHook::GetAddonId()
{
XBMC_TRACE;
- const char* id = NULL;
// Get a reference to the main module
// and global dictionary
@@ -138,8 +137,9 @@ namespace XBMCAddon
// Extract a reference to the function "func_name"
// from the global dictionary
PyObject* pyid = PyDict_GetItemString(global_dict, "__xbmcaddonid__");
- id = PyString_AsString(pyid);
- return id;
+ if (pyid)
+ return PyString_AsString(pyid);
+ return "";
}
String PythonLanguageHook::GetAddonVersion()
@@ -152,8 +152,9 @@ namespace XBMCAddon
// Extract a reference to the function "func_name"
// from the global dictionary
PyObject* pyversion = PyDict_GetItemString(global_dict, "__xbmcapiversion__");
- String version(PyString_AsString(pyversion));
- return version;
+ if (pyversion)
+ return PyString_AsString(pyversion);
+ return "";
}
void PythonLanguageHook::RegisterPlayerCallback(IPlayerCallback* player) { XBMC_TRACE; g_pythonParser.RegisterPythonPlayerCallBack(player); }

0 comments on commit e042b65

Please sign in to comment.