@@ -1664,13 +1664,12 @@ def check_steam_shortcut(self, title):
1664
1664
with open (steam_shortcuts_path , 'rb' ) as f :
1665
1665
shortcuts = vdf .binary_load (f )
1666
1666
for game in shortcuts ["shortcuts" ].values ():
1667
- if game ["AppName" ] == title :
1667
+ if isinstance ( game , dict ) and "AppName" in game and game ["AppName" ] == title :
1668
1668
return True
1669
1669
return False
1670
1670
except SyntaxError :
1671
1671
return False
1672
- else :
1673
- return False
1672
+ return False
1674
1673
1675
1674
def set_image_shortcut_icon (self , title , icons_path , icon_temp ):
1676
1675
@@ -2384,7 +2383,7 @@ def add_game_to_steam(title, game_directory, icon, command):
2384
2383
# Check if the game already exists
2385
2384
existing_app_id = None
2386
2385
for app_id , game_info in shortcuts ["shortcuts" ].items ():
2387
- if game_info ["AppName" ] == title :
2386
+ if isinstance ( game_info , dict ) and "AppName" in game_info and game_info ["AppName" ] == title :
2388
2387
existing_app_id = app_id
2389
2388
break
2390
2389
@@ -2397,7 +2396,7 @@ def add_game_to_steam(title, game_directory, icon, command):
2397
2396
game_info ["LaunchOptions" ] = f'"{ command } "'
2398
2397
else :
2399
2398
# Generate a new ID for the game
2400
- new_app_id = max ([int (k ) for k in shortcuts ["shortcuts" ].keys ()] or [0 ]) + 1
2399
+ new_app_id = max ([int (k ) for k in shortcuts ["shortcuts" ].keys () if k . isdigit () ] or [0 ]) + 1
2401
2400
2402
2401
# Add the new game
2403
2402
shortcuts ["shortcuts" ][str (new_app_id )] = {
@@ -4391,14 +4390,12 @@ def check_steam_shortcut(self, title):
4391
4390
with open (steam_shortcuts_path , 'rb' ) as f :
4392
4391
shortcuts = vdf .binary_load (f )
4393
4392
for game in shortcuts ["shortcuts" ].values ():
4394
- if game ["AppName" ] == title :
4393
+ if isinstance ( game , dict ) and "AppName" in game and game ["AppName" ] == title :
4395
4394
return True
4396
4395
return False
4397
4396
except SyntaxError :
4398
4397
return False
4399
- else :
4400
- return False
4401
-
4398
+ return False
4402
4399
4403
4400
def on_entry_query_tooltip (self , widget , x , y , keyboard_mode , tooltip ):
4404
4401
current_text = widget .get_text ()
0 commit comments