AI 144548: am: CL 144547 Fix change 144342 by making it active only during overlay processing.
  Original author: rgreenwalt

Automated import of CL 144548
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 6e522a2..a09b1a6 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -1449,8 +1449,11 @@
     if ((result = e->makeItABag(sourcePos)) != NO_ERROR) {
         return result;
     }
- 
-    return e->emptyBag(sourcePos);
+
+    if (replace) { 
+        return e->emptyBag(sourcePos);
+    }
+    return result;
 }
 
 status_t ResourceTable::addBag(const SourcePos& sourcePos,