diff --git a/Realm/RLMSchema.mm b/Realm/RLMSchema.mm index aeb72f9579..58d7c8482d 100644 --- a/Realm/RLMSchema.mm +++ b/Realm/RLMSchema.mm @@ -193,8 +193,8 @@ - (void)setObjectSchema:(NSArray *)objectSchema { } - (RLMObjectSchema *)schemaForClassName:(NSString *)className { - if (RLMObjectSchema *schema = _objectSchemaByName[className]) { - return schema; // fast path for already-initialized schemas + if (_objectSchemaByName.count > 0) { + return _objectSchemaByName[className]; // fast path for already-initialized schemas } else if (Class cls = [RLMSchema classForString:className]) { [cls sharedSchema]; // initialize the schema return _objectSchemaByName[className]; // try again