summaryrefslogtreecommitdiff
path: root/src/mbgl/style/image_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/image_impl.cpp')
-rw-r--r--src/mbgl/style/image_impl.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/mbgl/style/image_impl.cpp b/src/mbgl/style/image_impl.cpp
index c43bb552ee..939b1c130c 100644
--- a/src/mbgl/style/image_impl.cpp
+++ b/src/mbgl/style/image_impl.cpp
@@ -45,9 +45,7 @@ Image::Impl::Impl(std::string id_,
sdf(sdf_),
stretchX(std::move(stretchX_)),
stretchY(std::move(stretchY_)),
- content(content_
- ? std::move(*content_)
- : ImageContent{0, 0, static_cast<float>(image.size.width), static_cast<float>(image.size.height)}) {
+ content(std::move(content_)) {
if (!image.valid()) {
throw util::StyleImageException("dimensions may not be zero");
} else if (pixelRatio <= 0) {
@@ -56,7 +54,7 @@ Image::Impl::Impl(std::string id_,
throw util::StyleImageException("stretchX is out of bounds or overlapping");
} else if (!validateStretch(stretchY, image.size.height)) {
throw util::StyleImageException("stretchY is out of bounds or overlapping");
- } else if (!validateContent(content, image.size)) {
+ } else if (content && !validateContent(*content, image.size)) {
throw util::StyleImageException("content area is invalid");
}
}