try except to prevent crash when no portfolio_settings,json file

This commit is contained in:
Justin
2023-03-17 15:15:50 +08:00
committed by GitHub
parent bf6a515b17
commit e68401eb51

View File

@@ -1720,7 +1720,7 @@ class StockTicker():
else: else:
stitchedStock = midFrame stitchedStock = midFrame
try:
if all_stocks_settings['chart'] and (symbol in portfolio_settings): #IF USER INPUTTED PORTFOLIO SETTINGS, DISPLAY PORTFOLIO INFO if all_stocks_settings['chart'] and (symbol in portfolio_settings): #IF USER INPUTTED PORTFOLIO SETTINGS, DISPLAY PORTFOLIO INFO
try: try:
cost = portfolio_settings[symbol]['cost'] cost = portfolio_settings[symbol]['cost']
@@ -1801,13 +1801,18 @@ class StockTicker():
img.paste(daychange2_img, (x_offset, 24)) img.paste(daychange2_img, (x_offset, 24))
except: except:
pass pass
except:
pass
image_list.append(stitchedStock) image_list.append(stitchedStock)
try:
if all_stocks_settings['chart'] and (symbol in portfolio_settings): if all_stocks_settings['chart'] and (symbol in portfolio_settings):
try: try:
image_list.append(img) image_list.append(img)
except: except:
pass pass
except:
pass
image_list.append(self.blank) image_list.append(self.blank)
except Exception as e: except Exception as e:
pass pass