Consider one-line or add bracess: if (!key) return nil;