[ASDisplayNode Deallocation] Fix for crash when certain types are used as instance variables. (#2803)

* Fix https://github.com/facebook/AsyncDisplayKit/issues/2802

* Change nil to NULL
This commit is contained in:
haritowa
2016-12-20 01:06:23 +03:00
committed by Adlai Holler
parent f7a0ac9760
commit 64ee8dbffb
2 changed files with 2 additions and 2 deletions

View File

@@ -542,7 +542,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
Ivar ivar = allMyIvars[i];
const char *type = ivar_getTypeEncoding(ivar);
if (strcmp(type, @encode(id)) == 0) {
if (type != NULL && strcmp(type, @encode(id)) == 0) {
// If it's `id` we have to include it just in case.
resultIvars[resultCount] = ivar;
resultCount += 1;

View File

@@ -107,7 +107,7 @@ BOOL ASClassRequiresMainThreadDeallocation(Class class)
Class _Nullable ASGetClassFromType(const char *type)
{
// Class types all start with @"
if (strncmp(type, "@\"", 2) != 0) {
if (type == NULL || strncmp(type, "@\"", 2) != 0) {
return nil;
}