Description
I am using multiple YAML env files in EnvFile, where one file is intended to optionally override variables defined in another file.
This override file may sometimes contain variables, but in other cases it may be completely empty.
When this happens, the Run/Debug configuration fails to start and throws a NullPointerException.
This issue started occurring from version 3.3.0 (it did not happen before).
Current behavior
If one of the configured YAML files is empty, execution fails with:
Cannot invoke "java.util.Map.forEach(java.util.function.BiConsumer)" because the return value of
"net.ashald.envfile.EnvVarsProvider.getEnvVars(java.io.File, boolean, java.util.Map)" is null
This prevents the configuration from running, even though the other env files are valid.
Expected behavior
An empty YAML file should be treated as:
- a valid file with zero variables
- should not prevent execution
The plugin should return an empty map and continue processing the remaining files.
Steps to reproduce
- Create a Run/Debug configuration
- Enable EnvFile
- Add multiple YAML files:
- one with valid variables
- another YAML file that is empty
- Run the configuration
Possible cause
EnvVarsProvider.getEnvVars(...) appears to return null for empty YAML files, instead, it should return an empty map.
This would ensure empty YAML files are treated as contributing no variables, rather than causing a failure.