]> git.saurik.com Git - cycript.git/commitdiff
Fixed an occasional crash bug in sig::Type copying.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 20 Oct 2009 04:57:15 +0000 (04:57 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 20 Oct 2009 04:57:15 +0000 (04:57 +0000)
Library.mm

index a7da81ebe57b14208f8003836d7e6ee65b419883..e4bf70b8580f2ad3a07f334560296514153827e7 100644 (file)
@@ -469,9 +469,14 @@ void Copy(apr_pool_t *pool, Type &lhs, Type &rhs) {
     if (sig::IsAggregate(rhs.primitive))
         Copy(pool, lhs.data.signature, rhs.data.signature);
     else {
-        if (rhs.data.data.type != NULL) {
-            lhs.data.data.type = new(pool) Type;
-            Copy(pool, *lhs.data.data.type, *rhs.data.data.type);
+        sig::Type *&lht(lhs.data.data.type);
+        sig::Type *&rht(rhs.data.data.type);
+
+        if (rht == NULL)
+            lht = NULL;
+        else {
+            lht = new(pool) Type;
+            Copy(pool, *lht, *rht);
         }
 
         lhs.data.data.size = rhs.data.data.size;