Unidata / netcdf-java

The Unidata netcdf-java library
https://docs.unidata.ucar.edu/netcdf-java/current/userguide/index.html
BSD 3-Clause "New" or "Revised" License
144 stars 70 forks source link

Fix nullptr exception #1355

Closed tdrwenski closed 3 months ago

tdrwenski commented 3 months ago

Description of Changes

NcML aggregations are calling UrlNaming.resolveFile with the dataset URL as the baseDir and the netcdf location as the filepath. This is causing a nullptr exception in the MFileOS::getParent call when the dataset URL does not have any slashes so the parent is null. Maybe this function should not be called at all in this case (the URL is not a baseDir so it is a bit weird), but in any case this nullptr exception should be fixed. This PR fixes the nullptr exception in MFileOS and adds unit tests.