Dr0ptp4kt has submitted this change and it was merged. Change subject: Fix to handle malformed Nearby query results. ......................................................................
Fix to handle malformed Nearby query results. Reported issue to Max and he reverted the template change he identified as being responsible: https://en.wikipedia.org/w/index.php?title=Template%3AInfobox_settlement&diff=651351017&oldid=649234335 This patch makes nearby skip over query results which don't have valid coordinates. (In case this issue ever happens again) Change-Id: I7c0c7c3496adf0ee9aea9db8a056fc7a8e6d80ef --- M wikipedia/Networking/Fetchers/NearbyFetcher.m 1 file changed, 7 insertions(+), 2 deletions(-) Approvals: Dr0ptp4kt: Looks good to me, approved jenkins-bot: Verified diff --git a/wikipedia/Networking/Fetchers/NearbyFetcher.m b/wikipedia/Networking/Fetchers/NearbyFetcher.m index 0762723..a2e8c5e 100644 --- a/wikipedia/Networking/Fetchers/NearbyFetcher.m +++ b/wikipedia/Networking/Fetchers/NearbyFetcher.m @@ -129,8 +129,13 @@ NSDictionary* pages = jsonDict[@"query"][@"pages"]; if (pages) { for (NSDictionary* pageId in pages) { - NSDictionary* page = pages[pageId]; - NSArray* coordsArray = page[@"coordinates"]; + NSDictionary* page = pages[pageId]; + NSArray* coordsArray = page[@"coordinates"]; + + if (!coordsArray) { + continue; + } + NSDictionary* coords = coordsArray.firstObject; NSNumber* pageId = page[@"pageid"]; NSString* pageImage = page[@"pageimage"]; -- To view, visit https://gerrit.wikimedia.org/r/197259 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7c0c7c3496adf0ee9aea9db8a056fc7a8e6d80ef Gerrit-PatchSet: 1 Gerrit-Project: apps/ios/wikipedia Gerrit-Branch: master Gerrit-Owner: Mhurd <[email protected]> Gerrit-Reviewer: Bgerstle <[email protected]> Gerrit-Reviewer: Dr0ptp4kt <[email protected]> Gerrit-Reviewer: Fjalapeno <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
