Skip to content

Commit c456a25

Browse files
committed
[FIX] server: Avoid crash on autocompletion if file not found
If user is trying to autocomplete something that is not in the cache, the autocompletion should not crash.
1 parent c08ae62 commit c456a25

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

server/features/autocomplete.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ def autocomplete(path, content, line, char):
101101
return []
102102
before = before[1:]
103103
file_symbol = Odoo.get().get_file_symbol(path)
104+
if not file_symbol:
105+
return []
104106
module = file_symbol.get_module_sym()
105107
if not module:
106108
return []
@@ -157,6 +159,8 @@ def autocomplete(path, content, line, char):
157159
s = s[:-1]
158160
before = s
159161
file_symbol = Odoo.get().get_file_symbol(path)
162+
if not file_symbol:
163+
return []
160164
module = file_symbol.get_module_sym()
161165
models = Odoo.get().get_models(module, before)
162166
if not models:

0 commit comments

Comments
 (0)