Skip to content

Commit

Permalink
handle possible NaN/null id/alt_id in features
Browse files Browse the repository at this point in the history
  • Loading branch information
hellkite500 authored and donaldwj committed Nov 9, 2023
1 parent c95de42 commit e04edc0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/geojson/features/FeatureBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,16 @@ namespace geojson {
}

std::string get_id(std::string alt_id) const {
std::string tmp = id;
try{
return get_property(alt_id).as_string();
tmp = get_property(alt_id).as_string();
//if the property exists, but its value is NaN/null
if(tmp == "null") tmp = id;
}
catch(...){
return id;
tmp = id;
}
return tmp;
}

int get_number_of_destination_features() {
Expand Down

0 comments on commit e04edc0

Please sign in to comment.