Merge "libui: improve Region::validate"
diff --git a/libs/ui/Region.cpp b/libs/ui/Region.cpp
index b53c563..36da084 100644
--- a/libs/ui/Region.cpp
+++ b/libs/ui/Region.cpp
@@ -513,6 +513,12 @@
bool Region::validate(const Region& reg, const char* name, bool silent)
{
+ if (reg.mStorage.isEmpty()) {
+ ALOGE_IF(!silent, "%s: mStorage is empty, which is never valid", name);
+ // return immediately as the code below assumes mStorage is non-empty
+ return false;
+ }
+
bool result = true;
const_iterator cur = reg.begin();
const_iterator const tail = reg.end();