It is dangerous to ignore SkRect::intersect's return value
Review URL: https://codereview.chromium.org/833943002
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index ece8ff3..1652e61 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -704,8 +704,10 @@
SkRect content = SkRect::MakeWH(SkIntToScalar(pageSize.width()),
SkIntToScalar(pageSize.height()));
initialTransform.mapRect(&content);
- content.intersect(0, 0, SkIntToScalar(pageSize.width()),
- SkIntToScalar(pageSize.height()));
+ if (!content.intersect(0, 0, SkIntToScalar(pageSize.width()),
+ SkIntToScalar(pageSize.height()))) {
+ content.setEmpty();
+ }
SkISize contentSize =
SkISize::Make(SkScalarRoundToInt(content.width()),
SkScalarRoundToInt(content.height()));