Skip to content

Commit 26c511d

Browse files
fix: check for nil value when handle_log is called (#436)
Co-authored-by: JordanH <jordanh@apadmi.com>
1 parent 234a9d4 commit 26c511d

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lua/flutter-tools/dev_tools.lua

+12-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ local devtools_profiler_url = nil
2626

2727
local activate_cmd = { "pub", "global", "activate", "devtools" }
2828

29-
-- Android when flutter run starts a new devtools process
30-
-- OLD: Flutter DevTools, a Flutter debugger and profiler,
31-
-- on sdk gphone x86 arm is available at:
32-
-- http://127.0.0.1:9102?uri=http%3A%2F%2F127.0.0.1%3A46051%2FNvCev-HjyX4%3D%2F
33-
-- NEW: The Flutter DevTools debugger and profiler on sdk gphone x86 arm is available at:
34-
-- http://127.0.0.1:9100?uri=http%3A%2F%2F127.0.0.1%3A35479%2FgQ0BNyM2xB8%3D%2F
29+
---Android when flutter run starts a new devtools process
30+
---OLD: Flutter DevTools, a Flutter debugger and profiler,
31+
---on sdk gphone x86 arm is available at:
32+
---http://127.0.0.1:9102?uri=http%3A%2F%2F127.0.0.1%3A46051%2FNvCev-HjyX4%3D%2F
33+
---NEW: The Flutter DevTools debugger and profiler on sdk gphone x86 arm is available at:
34+
--- http://127.0.0.1:9100?uri=http%3A%2F%2F127.0.0.1%3A35479%2FgQ0BNyM2xB8%3D%2F
35+
---@param data string
36+
---@return unknown
3537
local function try_get_tools_flutter(data) return data:match("(https?://127%.0%.0%.1:%d+%?uri=.+)$") end
3638

3739
--- Debug service listening on ws://127.0.0.1:44293/heXbxLM_lhM=/ws
@@ -75,7 +77,10 @@ function M.open_dev_tools()
7577
end
7678
end
7779

80+
---@param data string?
7881
function M.handle_log(data)
82+
if not data then return end
83+
7984
if devtools_profiler_url or (profiler_url and devtools_url) then return end
8085

8186
devtools_profiler_url = try_get_tools_flutter(data)
@@ -233,6 +238,7 @@ function M.on_flutter_shutdown()
233238
end
234239

235240
function M.set_devtools_url(url) devtools_url = url end
241+
236242
function M.set_profiler_url(url) profiler_url = url end
237243

238244
return M

0 commit comments

Comments
 (0)