Skip to content

Commit 64d8a43

Browse files
authored
1 parent 11de36e commit 64d8a43

File tree

9 files changed

+89
-125
lines changed

9 files changed

+89
-125
lines changed

YapDatabase.xcodeproj/xcshareddata/xcschemes/TestModuleMap-watchOS (Glance).xcscheme

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
4343
shouldUseLaunchSchemeArgsEnv = "YES">
44-
<Testables>
45-
</Testables>
4644
<MacroExpansion>
4745
<BuildableReference
4846
BuildableIdentifier = "primary"
@@ -52,8 +50,8 @@
5250
ReferencedContainer = "container:YapDatabase.xcodeproj">
5351
</BuildableReference>
5452
</MacroExpansion>
55-
<AdditionalOptions>
56-
</AdditionalOptions>
53+
<Testables>
54+
</Testables>
5755
</TestAction>
5856
<LaunchAction
5957
buildConfiguration = "Debug"
@@ -66,29 +64,16 @@
6664
debugServiceExtension = "internal"
6765
allowLocationSimulation = "YES"
6866
launchAutomaticallySubstyle = "4">
69-
<RemoteRunnable
70-
runnableDebuggingMode = "2"
71-
BundleIdentifier = "com.apple.Carousel"
72-
RemotePath = "/TestModuleMap-iOS">
73-
<BuildableReference
74-
BuildableIdentifier = "primary"
75-
BlueprintIdentifier = "DC6266C81D80D3E000557968"
76-
BuildableName = "TestModuleMap-watchOS.app"
77-
BlueprintName = "TestModuleMap-watchOS"
78-
ReferencedContainer = "container:YapDatabase.xcodeproj">
79-
</BuildableReference>
80-
</RemoteRunnable>
81-
<MacroExpansion>
67+
<BuildableProductRunnable
68+
runnableDebuggingMode = "0">
8269
<BuildableReference
8370
BuildableIdentifier = "primary"
8471
BlueprintIdentifier = "DC6266C81D80D3E000557968"
8572
BuildableName = "TestModuleMap-watchOS.app"
8673
BlueprintName = "TestModuleMap-watchOS"
8774
ReferencedContainer = "container:YapDatabase.xcodeproj">
8875
</BuildableReference>
89-
</MacroExpansion>
90-
<AdditionalOptions>
91-
</AdditionalOptions>
76+
</BuildableProductRunnable>
9277
</LaunchAction>
9378
<ProfileAction
9479
buildConfiguration = "Release"
@@ -97,27 +82,16 @@
9782
useCustomWorkingDirectory = "NO"
9883
debugDocumentVersioning = "YES"
9984
launchAutomaticallySubstyle = "4">
100-
<RemoteRunnable
101-
runnableDebuggingMode = "2"
102-
BundleIdentifier = "com.apple.Carousel"
103-
RemotePath = "/TestModuleMap-iOS">
85+
<BuildableProductRunnable
86+
runnableDebuggingMode = "0">
10487
<BuildableReference
10588
BuildableIdentifier = "primary"
10689
BlueprintIdentifier = "DC6266C81D80D3E000557968"
10790
BuildableName = "TestModuleMap-watchOS.app"
10891
BlueprintName = "TestModuleMap-watchOS"
10992
ReferencedContainer = "container:YapDatabase.xcodeproj">
11093
</BuildableReference>
111-
</RemoteRunnable>
112-
<MacroExpansion>
113-
<BuildableReference
114-
BuildableIdentifier = "primary"
115-
BlueprintIdentifier = "DC6266C81D80D3E000557968"
116-
BuildableName = "TestModuleMap-watchOS.app"
117-
BlueprintName = "TestModuleMap-watchOS"
118-
ReferencedContainer = "container:YapDatabase.xcodeproj">
119-
</BuildableReference>
120-
</MacroExpansion>
94+
</BuildableProductRunnable>
12195
</ProfileAction>
12296
<AnalyzeAction
12397
buildConfiguration = "Debug">

YapDatabase.xcodeproj/xcshareddata/xcschemes/TestModuleMap-watchOS (Notification).xcscheme

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
4343
shouldUseLaunchSchemeArgsEnv = "YES">
44-
<Testables>
45-
</Testables>
4644
<MacroExpansion>
4745
<BuildableReference
4846
BuildableIdentifier = "primary"
@@ -52,8 +50,8 @@
5250
ReferencedContainer = "container:YapDatabase.xcodeproj">
5351
</BuildableReference>
5452
</MacroExpansion>
55-
<AdditionalOptions>
56-
</AdditionalOptions>
53+
<Testables>
54+
</Testables>
5755
</TestAction>
5856
<LaunchAction
5957
buildConfiguration = "Debug"
@@ -66,29 +64,16 @@
6664
debugServiceExtension = "internal"
6765
allowLocationSimulation = "YES"
6866
launchAutomaticallySubstyle = "8">
69-
<RemoteRunnable
70-
runnableDebuggingMode = "2"
71-
BundleIdentifier = "com.apple.Carousel"
72-
RemotePath = "/TestModuleMap-iOS">
73-
<BuildableReference
74-
BuildableIdentifier = "primary"
75-
BlueprintIdentifier = "DC6266C81D80D3E000557968"
76-
BuildableName = "TestModuleMap-watchOS.app"
77-
BlueprintName = "TestModuleMap-watchOS"
78-
ReferencedContainer = "container:YapDatabase.xcodeproj">
79-
</BuildableReference>
80-
</RemoteRunnable>
81-
<MacroExpansion>
67+
<BuildableProductRunnable
68+
runnableDebuggingMode = "0">
8269
<BuildableReference
8370
BuildableIdentifier = "primary"
8471
BlueprintIdentifier = "DC6266C81D80D3E000557968"
8572
BuildableName = "TestModuleMap-watchOS.app"
8673
BlueprintName = "TestModuleMap-watchOS"
8774
ReferencedContainer = "container:YapDatabase.xcodeproj">
8875
</BuildableReference>
89-
</MacroExpansion>
90-
<AdditionalOptions>
91-
</AdditionalOptions>
76+
</BuildableProductRunnable>
9277
</LaunchAction>
9378
<ProfileAction
9479
buildConfiguration = "Release"
@@ -97,27 +82,16 @@
9782
useCustomWorkingDirectory = "NO"
9883
debugDocumentVersioning = "YES"
9984
launchAutomaticallySubstyle = "8">
100-
<RemoteRunnable
101-
runnableDebuggingMode = "2"
102-
BundleIdentifier = "com.apple.Carousel"
103-
RemotePath = "/TestModuleMap-iOS">
85+
<BuildableProductRunnable
86+
runnableDebuggingMode = "0">
10487
<BuildableReference
10588
BuildableIdentifier = "primary"
10689
BlueprintIdentifier = "DC6266C81D80D3E000557968"
10790
BuildableName = "TestModuleMap-watchOS.app"
10891
BlueprintName = "TestModuleMap-watchOS"
10992
ReferencedContainer = "container:YapDatabase.xcodeproj">
11093
</BuildableReference>
111-
</RemoteRunnable>
112-
<MacroExpansion>
113-
<BuildableReference
114-
BuildableIdentifier = "primary"
115-
BlueprintIdentifier = "DC6266C81D80D3E000557968"
116-
BuildableName = "TestModuleMap-watchOS.app"
117-
BlueprintName = "TestModuleMap-watchOS"
118-
ReferencedContainer = "container:YapDatabase.xcodeproj">
119-
</BuildableReference>
120-
</MacroExpansion>
94+
</BuildableProductRunnable>
12195
</ProfileAction>
12296
<AnalyzeAction
12397
buildConfiguration = "Debug">

YapDatabase.xcodeproj/xcshareddata/xcschemes/TestModuleMap-watchOS.xcscheme

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
4343
shouldUseLaunchSchemeArgsEnv = "YES">
44-
<Testables>
45-
</Testables>
4644
<MacroExpansion>
4745
<BuildableReference
4846
BuildableIdentifier = "primary"
@@ -52,8 +50,8 @@
5250
ReferencedContainer = "container:YapDatabase.xcodeproj">
5351
</BuildableReference>
5452
</MacroExpansion>
55-
<AdditionalOptions>
56-
</AdditionalOptions>
53+
<Testables>
54+
</Testables>
5755
</TestAction>
5856
<LaunchAction
5957
buildConfiguration = "Debug"
@@ -65,57 +63,33 @@
6563
debugDocumentVersioning = "YES"
6664
debugServiceExtension = "internal"
6765
allowLocationSimulation = "YES">
68-
<RemoteRunnable
69-
runnableDebuggingMode = "2"
70-
BundleIdentifier = "com.apple.Carousel"
71-
RemotePath = "/TestModuleMap-iOS">
72-
<BuildableReference
73-
BuildableIdentifier = "primary"
74-
BlueprintIdentifier = "DC6266C81D80D3E000557968"
75-
BuildableName = "TestModuleMap-watchOS.app"
76-
BlueprintName = "TestModuleMap-watchOS"
77-
ReferencedContainer = "container:YapDatabase.xcodeproj">
78-
</BuildableReference>
79-
</RemoteRunnable>
80-
<MacroExpansion>
66+
<BuildableProductRunnable
67+
runnableDebuggingMode = "0">
8168
<BuildableReference
8269
BuildableIdentifier = "primary"
8370
BlueprintIdentifier = "DC6266C81D80D3E000557968"
8471
BuildableName = "TestModuleMap-watchOS.app"
8572
BlueprintName = "TestModuleMap-watchOS"
8673
ReferencedContainer = "container:YapDatabase.xcodeproj">
8774
</BuildableReference>
88-
</MacroExpansion>
89-
<AdditionalOptions>
90-
</AdditionalOptions>
75+
</BuildableProductRunnable>
9176
</LaunchAction>
9277
<ProfileAction
9378
buildConfiguration = "Release"
9479
shouldUseLaunchSchemeArgsEnv = "YES"
9580
savedToolIdentifier = ""
9681
useCustomWorkingDirectory = "NO"
9782
debugDocumentVersioning = "YES">
98-
<RemoteRunnable
99-
runnableDebuggingMode = "2"
100-
BundleIdentifier = "com.apple.Carousel"
101-
RemotePath = "/TestModuleMap-iOS">
83+
<BuildableProductRunnable
84+
runnableDebuggingMode = "0">
10285
<BuildableReference
10386
BuildableIdentifier = "primary"
10487
BlueprintIdentifier = "DC6266C81D80D3E000557968"
10588
BuildableName = "TestModuleMap-watchOS.app"
10689
BlueprintName = "TestModuleMap-watchOS"
10790
ReferencedContainer = "container:YapDatabase.xcodeproj">
10891
</BuildableReference>
109-
</RemoteRunnable>
110-
<MacroExpansion>
111-
<BuildableReference
112-
BuildableIdentifier = "primary"
113-
BlueprintIdentifier = "DC6266C81D80D3E000557968"
114-
BuildableName = "TestModuleMap-watchOS.app"
115-
BlueprintName = "TestModuleMap-watchOS"
116-
ReferencedContainer = "container:YapDatabase.xcodeproj">
117-
</BuildableReference>
118-
</MacroExpansion>
92+
</BuildableProductRunnable>
11993
</ProfileAction>
12094
<AnalyzeAction
12195
buildConfiguration = "Debug">

YapDatabase/Extensions/AutoView/YapDatabaseAutoViewTransaction.m

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,13 @@ - (void)insertRowid:(int64_t)rowid
608608
object:&anotherObject
609609
forRowid:anotherRowid];
610610

611-
return sortingBlock(databaseTransaction, group,
612-
collectionKey.collection, collectionKey.key, object,
613-
another.collection, another.key, anotherObject);
611+
if (object && anotherObject) {
612+
return sortingBlock(databaseTransaction, group,
613+
collectionKey.collection, collectionKey.key, object,
614+
another.collection, another.key, anotherObject);
615+
} else {
616+
return NSOrderedAscending;
617+
}
614618
}
615619
else if (sorting->blockType == YapDatabaseBlockTypeWithMetadata)
616620
{
@@ -640,9 +644,14 @@ - (void)insertRowid:(int64_t)rowid
640644
metadata:&anotherMetadata
641645
forRowid:anotherRowid];
642646

643-
return sortingBlock(databaseTransaction, group,
644-
collectionKey.collection, collectionKey.key, object, metadata,
645-
another.collection, another.key, anotherObject, anotherMetadata);
647+
if (object && anotherObject) {
648+
return sortingBlock(databaseTransaction, group,
649+
collectionKey.collection, collectionKey.key, object, metadata,
650+
another.collection, another.key, anotherObject, anotherMetadata);
651+
} else {
652+
return NSOrderedAscending;
653+
}
654+
646655
}
647656

648657
#pragma clang diagnostic pop
@@ -1485,7 +1494,11 @@ - (NSRange)findRangeInGroup:(NSString *)group using:(YapDatabaseViewFind *)find
14851494
id object = nil;
14861495
[databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
14871496

1488-
return findBlock(ck.collection, ck.key, object);
1497+
if (ck && object) {
1498+
return findBlock(ck.collection, ck.key, object);
1499+
} else {
1500+
return NSOrderedAscending;
1501+
}
14891502

14901503
#pragma clang diagnostic pop
14911504
};
@@ -1532,7 +1545,11 @@ - (NSRange)findRangeInGroup:(NSString *)group using:(YapDatabaseViewFind *)find
15321545
id metadata = nil;
15331546
[databaseTransaction getCollectionKey:&ck object:&object metadata:&metadata forRowid:rowid];
15341547

1535-
return findBlock(ck.collection, ck.key, object, metadata);
1548+
if (ck && object) {
1549+
return findBlock(ck.collection, ck.key, object, metadata);
1550+
} else {
1551+
return NSOrderedAscending;
1552+
}
15361553

15371554
#pragma clang diagnostic pop
15381555
};

YapDatabase/Extensions/AutoView/YapDatabaseViewTypes.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ typedef NSComparisonResult (^YapDatabaseViewSortingWithKeyBlock)
121121

122122
typedef NSComparisonResult (^YapDatabaseViewSortingWithObjectBlock)
123123
(YapDatabaseReadTransaction *transaction, NSString *group,
124-
NSString *collection1, NSString *key1, id object1,
125-
NSString *collection2, NSString *key2, id object2);
124+
NSString *collection1, NSString *key1, _Nullable id object1,
125+
NSString *collection2, NSString *key2, _Nullable id object2);
126126

127127
typedef NSComparisonResult (^YapDatabaseViewSortingWithMetadataBlock)
128128
(YapDatabaseReadTransaction *transaction, NSString *group,
@@ -131,8 +131,8 @@ typedef NSComparisonResult (^YapDatabaseViewSortingWithMetadataBlock)
131131

132132
typedef NSComparisonResult (^YapDatabaseViewSortingWithRowBlock)
133133
(YapDatabaseReadTransaction *transaction, NSString *group,
134-
NSString *collection1, NSString *key1, id object1, _Nullable id metadata1,
135-
NSString *collection2, NSString *key2, id object2, _Nullable id metadata2);
134+
NSString *collection1, NSString *key1, _Nullable id object1, _Nullable id metadata1,
135+
NSString *collection2, NSString *key2, _Nullable id object2, _Nullable id metadata2);
136136

137137
+ (instancetype)withKeyBlock:(YapDatabaseViewSortingWithKeyBlock)block;
138138
+ (instancetype)withObjectBlock:(YapDatabaseViewSortingWithObjectBlock)block;
@@ -207,13 +207,13 @@ typedef NSComparisonResult (^YapDatabaseViewFindWithKeyBlock)
207207
(NSString *collection, NSString *key);
208208

209209
typedef NSComparisonResult (^YapDatabaseViewFindWithObjectBlock)
210-
(NSString *collection, NSString *key, id object);
210+
(NSString *collection, NSString *key, _Nullable id object);
211211

212212
typedef NSComparisonResult (^YapDatabaseViewFindWithMetadataBlock)
213213
(NSString *collection, NSString *key, _Nullable id metadata);
214214

215215
typedef NSComparisonResult (^YapDatabaseViewFindWithRowBlock)
216-
(NSString *collection, NSString *key, id object, _Nullable id metadata);
216+
(NSString *collection, NSString *key, _Nullable id object, _Nullable id metadata);
217217

218218
+ (instancetype)withKeyBlock:(YapDatabaseViewFindWithKeyBlock)findBlock;
219219
+ (instancetype)withObjectBlock:(YapDatabaseViewFindWithObjectBlock)findBlock;

YapDatabase/Extensions/RTreeIndex/YapDatabaseRTreeIndexTransaction.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,9 @@ - (BOOL)enumerateKeysAndObjectsMatchingQuery:(YapDatabaseQuery *)query
11551155
id object = nil;
11561156
[self->databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
11571157

1158-
block(ck.collection, ck.key, object, stop);
1158+
if (ck && object) {
1159+
block(ck.collection, ck.key, object, stop);
1160+
}
11591161
}];
11601162

11611163
return result;
@@ -1175,7 +1177,9 @@ - (BOOL)enumerateRowsMatchingQuery:(YapDatabaseQuery *)query
11751177
id metadata = nil;
11761178
[self->databaseTransaction getCollectionKey:&ck object:&object metadata:&metadata forRowid:rowid];
11771179

1178-
block(ck.collection, ck.key, object, metadata, stop);
1180+
if (ck && object) {
1181+
block(ck.collection, ck.key, object, metadata, stop);
1182+
}
11791183
}];
11801184

11811185
return result;

YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,9 @@ - (BOOL)enumerateKeysAndObjectsMatchingQuery:(YapDatabaseQuery *)query
12851285
id object = nil;
12861286
[self->databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
12871287

1288-
block(ck.collection, ck.key, object, stop);
1288+
if (ck && object) {
1289+
block(ck.collection, ck.key, object, stop);
1290+
}
12891291
}];
12901292

12911293
return result;

YapDatabase/Extensions/View/YapDatabaseViewTransaction.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,13 @@ - (void)insertRowid:(int64_t)rowid collectionKey:(YapCollectionKey *)collectionK
13041304

13051305
NSString *pageKey = pageMetadata->pageKey;
13061306
YapDatabaseViewPage *page = [self pageForPageKey:pageKey];
1307+
1308+
NSAssert(page != nil, @"Missing page in group(%@)", group);
1309+
1310+
if (!page) {
1311+
YDBLogError(@"Missing page in group(%@)! Error inserting key(%@) collection(%@) in group(%@) at index(%lu) with page(nil) pageOffset(%lu)", group, collectionKey.key, collectionKey.collection, group, index, pageOffset);
1312+
return;
1313+
}
13071314

13081315
YDBLogVerbose(@"Inserting key(%@) collection(%@) in group(%@) at index(%lu) with page(%@) pageOffset(%lu)",
13091316
collectionKey.key, collectionKey.collection, group,

0 commit comments

Comments
 (0)