Skip to content

Commit e16614a

Browse files
committed
Program a bit more defensively
Even though /setup/eureka_info should always be JSON...
1 parent ea4dd02 commit e16614a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/auxiliary/scanner/chromecast/chromecast_webserver.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ def run_host(ip)
4040

4141
return unless (res && res.code == 200)
4242

43-
json = JSON.parse(res.body)
43+
begin
44+
json = JSON.parse(res.body)
45+
rescue JSON::ParserError
46+
return
47+
end
48+
4449
name, ssid = json['name'], json['ssid']
4550

4651
if name && ssid

0 commit comments

Comments
 (0)