Skip to content

Commit cfc6f3f

Browse files
committed
handle path being None
1 parent f9ff34e commit cfc6f3f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

client/commands/v2/pysa_server.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,14 @@ def invalid_models_to_diagnostics(
9191
) -> Dict[Path, List[lsp.Diagnostic]]:
9292
result: Dict[Path, List[lsp.Diagnostic]] = {}
9393
for model in invalid_models:
94-
result.setdefault(Path(model.path), []).append(
95-
self.invalid_model_to_diagnostic(model)
96-
)
94+
if model.path is None:
95+
self.log_and_show_message_to_client(
96+
"Path cannot be None", lsp.MessageType.WARNING
97+
)
98+
else:
99+
result.setdefault(Path(model.path), []).append(
100+
self.invalid_model_to_diagnostic(model)
101+
)
97102
return result
98103

99104
async def update_errors(self, document_path: Path) -> None:

0 commit comments

Comments
 (0)