This repository was archived by the owner on Nov 4, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
src/Analysis/Ast/Impl/Modules Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -406,15 +406,20 @@ public void NotifyAnalysisBegins() {
406
406
// In all variables find those imported, then traverse imported modules
407
407
// and remove references to this module. If variable refers to a module,
408
408
// recurse into module but only process global scope.
409
+
410
+ if ( GlobalScope == null ) {
411
+ return ;
412
+ }
413
+
414
+ // TODO: Figure out where the nulls below are coming from.
409
415
var importedVariables = ( ( IScope ) GlobalScope )
410
- . TraverseDepthFirst ( c => c . Children )
411
- . ExcludeDefault ( )
412
- . SelectMany ( s => s . Variables )
413
- . Where ( v => v . Source == VariableSource . Import ) ;
416
+ . TraverseDepthFirst ( c => c ? . Children ?? Enumerable . Empty < IScope > ( ) )
417
+ . SelectMany ( s => s ? . Variables ?? VariableCollection . Empty )
418
+ . Where ( v => v ? . Source == VariableSource . Import ) ;
414
419
415
420
foreach ( var v in importedVariables ) {
416
421
v . RemoveReferences ( this ) ;
417
- if ( v . Value is IPythonModule module ) {
422
+ if ( v . Value is IPythonModule module ) {
418
423
RemoveReferencesInModule ( module ) ;
419
424
}
420
425
}
You can’t perform that action at this time.
0 commit comments