@@ -848,6 +848,11 @@ public function gameOrStatus(Request $request, $route, $channel = null)
848848
849849 $ getGame = $ this ->twitchApi ->channels ($ channel , $ this ->version );
850850
851+ // Invalid API response
852+ if (empty ($ getGame )) {
853+ return Helper::text (__ ('generic.error_loading_data_api ' ));
854+ }
855+
851856 if (isset ($ getGame ['message ' ])) {
852857 return Helper::text (sprintf ('%s - %s ' , $ getGame ['error ' ], $ getGame ['message ' ]));
853858 }
@@ -1652,6 +1657,11 @@ public function subcount(Request $request, $subcount = null, $channel = null)
16521657
16531658 $ data = $ this ->twitchApi ->channelSubscriptions ($ user ->id , $ token , 1 , 0 , 'asc ' , $ this ->version );
16541659
1660+ // Invalid API response
1661+ if (empty ($ data )) {
1662+ return Helper::text (__ ('generic.error_loading_data_api ' ));
1663+ }
1664+
16551665 if (!empty ($ data ['status ' ])) {
16561666 if ($ data ['status ' ] === 401 ) {
16571667 return Helper::text ($ needToReAuth );
@@ -1854,6 +1864,11 @@ public function subEmotes(Request $request, $channel = null)
18541864 return Helper::text ('Error occurred retrieving user information for Twitch user: ' . $ channel );
18551865 }
18561866
1867+ // API returned an empty response, most likely disabled/banned user or it doesn't exist.
1868+ if (empty ($ user )) {
1869+ return Helper::text (__ ('twitch.user_not_found ' , ['user ' => $ channel ]));
1870+ }
1871+
18571872 if (!empty ($ user ['message ' ])) {
18581873 return Helper::text ($ user ['message ' ]);
18591874 }
0 commit comments