From 3a4d5bbe4c06f30b15125297a3550b91961d2b0f Mon Sep 17 00:00:00 2001 From: Tom Longridge Date: Tue, 14 Jul 2020 10:25:40 +0100 Subject: [PATCH] fix(breadcrumbs): further refactor of count into barrier guard --- Bugsnag/Breadcrumbs/BugsnagBreadcrumbs.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bugsnag/Breadcrumbs/BugsnagBreadcrumbs.m b/Bugsnag/Breadcrumbs/BugsnagBreadcrumbs.m index 6391637f0..0a1f2138e 100644 --- a/Bugsnag/Breadcrumbs/BugsnagBreadcrumbs.m +++ b/Bugsnag/Breadcrumbs/BugsnagBreadcrumbs.m @@ -116,9 +116,9 @@ - (NSArray *)cachedBreadcrumbs { } - (NSArray *)arrayValue { - __block NSMutableArray *contents = - [[NSMutableArray alloc] initWithCapacity:self.breadcrumbs.count]; + __block NSMutableArray *contents; dispatch_barrier_sync(self.readWriteQueue, ^{ + contents = [[NSMutableArray alloc] initWithCapacity:self.breadcrumbs.count]; for (BugsnagBreadcrumb *crumb in self.breadcrumbs) { NSDictionary *objectValue = [crumb objectValue]; NSError *error = nil;