Additional NPE safety in OnlineNMLModelLODTreeDataSource
@@ -43,6 +43,10 @@ namespace carto {
Log::Error("OnlineNMLModelLODTreeDataSource: Failed to receive tile list.");
return std::vector<MapTile>();
}
+ if (!response) {
+ Log::Error("OnlineNMLModelLODTreeDataSource: Empty response.");
+ return std::vector<MapTile>();
+ }
DataInputStream gzipStream(*response->getDataPtr());
int gzipDataSize = gzipStream.readInt();
@@ -85,6 +89,10 @@ namespace carto {
Log::Error("OnlineNMLModelLODTreeDataSource: Failed to receive LOD tree.");
return std::shared_ptr<NMLModelLODTree>();
}
+ if (!response) {
+ Log::Error("OnlineNMLModelLODTreeDataSource: Empty response.");
+ return std::shared_ptr<NMLModelLODTree>();
+ }
DataInputStream gzipStream(*response->getDataPtr());
int gzipDataSize = gzipStream.readInt();
@@ -168,6 +176,10 @@ namespace carto {
Log::Error("OnlineNMLModelLODTreeDataSource: Failed to receive mesh data.");
return std::shared_ptr<nml::Mesh>();
}
+ if (!response) {
+ Log::Error("OnlineNMLModelLODTreeDataSource: Empty response.");
+ return std::shared_ptr<nml::Mesh>();
+ }
DataInputStream gzipStream(*response->getDataPtr());
gzipStream.readLongLong();
@@ -195,6 +207,10 @@ namespace carto {
Log::Error("OnlineNMLModelLODTreeDataSource: Failed to receive texture data.");
return std::shared_ptr<nml::Texture>();
}
+ if (!response) {
+ Log::Error("OnlineNMLModelLODTreeDataSource: Empty response.");
+ return std::shared_ptr<nml::Texture>();
+ }
DataInputStream gzipStream(*response->getDataPtr());
gzipStream.readLongLong();
