diff --git a/python/swiftest/swiftest/init_cond.py b/python/swiftest/swiftest/init_cond.py index fba02b387..978fe9808 100644 --- a/python/swiftest/swiftest/init_cond.py +++ b/python/swiftest/swiftest/init_cond.py @@ -56,9 +56,12 @@ def get_Gmass(raw_response): if len(GM) == 0: return None GM = GM[0] - GM = GM.split('GM')[1] - GM = GM.split('=')[1] - GM = GM.strip().split(' ')[0].split('+')[0] + if len(GM) > 1: + GM = GM.split('GM')[1] + if len(GM) > 1: + GM = GM.split('=') + if len(GM) > 1: + GM = GM[1].strip().split(' ')[0].split('+')[0] try: GM = float(GM) except: