From bf44cb8cdf0e4107a3c0cd674c2e19057b6092f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 16 Dec 2023 09:13:41 +0100 Subject: [PATCH] Do not crash on missing exports, closes #2400 --- lib/livebook/intellisense/identifier_matcher.ex | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/livebook/intellisense/identifier_matcher.ex b/lib/livebook/intellisense/identifier_matcher.ex index 35cda1b49..e3cd8fc03 100644 --- a/lib/livebook/intellisense/identifier_matcher.ex +++ b/lib/livebook/intellisense/identifier_matcher.ex @@ -707,9 +707,16 @@ defmodule Livebook.Intellisense.IdentifierMatcher do end defp exports(mod, node) do - for {fun, arity} <- :erpc.call(node, mod, :module_info, [:exports]), - not reflection?(fun, arity), - do: function_or_macro(Atom.to_string(fun), fun, arity) + try do + :erpc.call(node, mod, :module_info, [:exports]) + rescue + _ -> [] + else + exports -> + for {fun, arity} <- exports, + not reflection?(fun, arity), + do: function_or_macro(Atom.to_string(fun), fun, arity) + end end defp reflection?(:module_info, 0), do: true