ECC-1073: grib_ls/bufr_ls with the JSON option: Set key 'file'

This commit is contained in:
Shahram Najm 2020-02-13 18:18:46 +00:00
parent b11cdf670f
commit 65c337cf69
2 changed files with 2 additions and 2 deletions

View File

@ -105,7 +105,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
exit(err);
}
if (options->json_output) {
if (options->current_infile->name) {
if (options->current_infile && options->current_infile->name) {
size_t len = strlen(options->current_infile->name);
grib_set_string(h, "file", options->current_infile->name, &len);
}

View File

@ -360,7 +360,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
}
if (!json_latlon && options->json_output) {
if (options->current_infile->name) {
if (options->current_infile && options->current_infile->name) {
size_t len = strlen(options->current_infile->name);
grib_set_string(h, "file", options->current_infile->name, &len);
}