Skip to content

Commit

Permalink
Fix crash when there is no remote datasource response.
Browse files Browse the repository at this point in the history
  • Loading branch information
josephbirkner committed Jun 14, 2024
1 parent 7b3da51 commit 1705d77
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions libs/http-datasource/src/datasource-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,20 @@ RemoteDataSource::get(const MapTileKey& k, Cache::Ptr& cache, const DataSourceIn
// Forward to base class get(). This will instantiate a
// default TileFeatureLayer and call fill(). In our implementation
// of fill, we set an error.
if (tileResponse->has_header("HTTPLIB_ERROR")) {
error_ = tileResponse->get_header_value("HTTPLIB_ERROR");
}
else if (tileResponse->has_header("EXCEPTION_WHAT")) {
error_ = tileResponse->get_header_value("EXCEPTION_WHAT");

if (tileResponse) {
if (tileResponse->has_header("HTTPLIB_ERROR")) {
error_ = tileResponse->get_header_value("HTTPLIB_ERROR");
}
else if (tileResponse->has_header("EXCEPTION_WHAT")) {
error_ = tileResponse->get_header_value("EXCEPTION_WHAT");
}
else {
error_ = fmt::format("Code {}", tileResponse->status);
}
}
else {
error_ = fmt::format("Code {}", tileResponse->status);
error_ = "No remote response.";
}

// Use tile instantiation logic of the base class,
Expand Down

0 comments on commit 1705d77

Please sign in to comment.