Fix NPE when working with non-project files