Skip to content

Commit ff52aa4

Browse files
Fixes #138. String index out of range.
1 parent a2a831f commit ff52aa4

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

resources/main.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7893,7 +7893,7 @@ def _command_run_standalone_launcher(self, categoryID, launcherID):
78937893
application_str = launcher['application']
78947894
arguments_str = launcher['args']
78957895
app_cleaned = application_str.lower().replace('.exe' , '')
7896-
if app_cleaned == 'xbmc' or app_cleaned == 'kodi' or \
7896+
if app_cleaned == 'xbmc' or app_cleaned == 'kodi' or \
78977897
'xbmc-fav-' in app_cleaned or 'xbmc-sea-' in app_cleaned or \
78987898
'kodi-fav-' in app_cleaned or 'kodi-sea-' in app_cleaned:
78997899
log_info('_run_standalone_launcher() Executing Kodi builtin function')
@@ -8230,9 +8230,6 @@ def _run_process(self, application, arguments, apppath, romext, non_blocking_fla
82308230
#
82318231
if is_windows():
82328232
app_ext = application.split('.')[-1]
8233-
# Remove initial and trailing quotes to avoid double quotation.
8234-
application = misc_strip_quotes(application)
8235-
arguments = misc_strip_quotes(arguments)
82368233
log_debug('_run_process() (Windows) application = "{}"'.format(application))
82378234
log_debug('_run_process() (Windows) arguments = "{}"'.format(arguments))
82388235
log_debug('_run_process() (Windows) apppath = "{}"'.format(apppath))
@@ -8241,6 +8238,8 @@ def _run_process(self, application, arguments, apppath, romext, non_blocking_fla
82418238

82428239
# Standalone launcher where application is a LNK file
82438240
if app_ext == 'lnk' or app_ext == 'LNK':
8241+
# Remove initial and trailing quotes to avoid double quotation.
8242+
application = misc_strip_quotes(application)
82448243
if ADDON_RUNNING_PYTHON_2:
82458244
c = 'start "AEL" /b "{}"'.format(application).encode('utf-8')
82468245
elif ADDON_RUNNING_PYTHON_3:
@@ -8253,6 +8252,8 @@ def _run_process(self, application, arguments, apppath, romext, non_blocking_fla
82538252

82548253
# ROM launcher where ROMs are LNK files
82558254
elif romext == 'lnk' or romext == 'LNK':
8255+
# Remove initial and trailing quotes to avoid double quotation.
8256+
arguments = misc_strip_quotes(arguments)
82568257
if ADDON_RUNNING_PYTHON_2:
82578258
c = 'start "AEL" /b "{}"'.format(arguments).encode('utf-8')
82588259
elif ADDON_RUNNING_PYTHON_3:

resources/misc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,9 @@ def misc_identify_image_id_by_ext(asset_fname):
720720
return IMAGE_UKNOWN_ID
721721

722722
# Remove initial and trailing quotation characters " or '
723+
# String must have 3 characters or more.
723724
def misc_strip_quotes(my_str):
725+
if len(my_str) < 3: return my_str
724726
my_str = my_str[1:] if my_str[0] == '"' or my_str[0] == "'" else my_str
725727
my_str = my_str[:-1] if my_str[-1] == '"' or my_str[-1] == "'" else my_str
726728
return my_str

0 commit comments

Comments
 (0)