File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,13 @@ - (void)cancelTimer
127
127
128
128
- (void )processRequest : (AMALocationRequest *)request
129
129
{
130
- AMAArrayIterator *hostsProvider = [[AMAArrayIterator alloc ] initWithArray: self .configuration.hosts];
130
+ NSArray *hosts = self.configuration .hosts ;
131
+ if (hosts.count == 0 ) {
132
+ AMALogError (@" Unable to retrieve host for location request" );
133
+ return ;
134
+ }
135
+
136
+ AMAArrayIterator *hostsProvider = [[AMAArrayIterator alloc ] initWithArray: hosts];
131
137
132
138
if (request == nil ) {
133
139
NSError *internalError = [AMAErrorsFactory internalInconsistencyError: @" Failed to process location request" ];
Original file line number Diff line number Diff line change 153
153
[[executor should ] receive: @selector (executeAfterDelay:block: )];
154
154
[dispatcher handleVisitAdd ];
155
155
});
156
+
157
+ it (@" Should not process request if no hosts are provided" , ^{
158
+ [configuration stub: @selector (hosts ) andReturn: @[]];
159
+ [[requestProcessor shouldNot ] receive: @selector (processWithCallback: )];
160
+ [dispatcher handleVisitAdd ];
161
+ });
156
162
157
163
context (@" Callback location" , ^{
158
164
beforeEach (^{
You can’t perform that action at this time.
0 commit comments