diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2017-12-21 00:28:19 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2017-12-21 12:02:20 -0800 |
commit | 1b407e85e9ee03124e24b71a856045c254775e6e (patch) | |
tree | 627cdb68cf1db38126e838fea73c19f87e383a8c /platform/darwin/src/MGLMapSnapshotter.h | |
parent | b9ef2727303bd2858b8fe1203adb0914a83ea0af (diff) | |
download | qtlocation-mapboxgl-1b407e85e9ee03124e24b71a856045c254775e6e.tar.gz |
[ios, macos] Fixed MGLMapSnapshotter test crash
Fixed a crash in MGLDocumentationExampleTests caused by an asynchronous snapshot call that the test wasn’t waiting on, compounded by the use of a style that requires an access token (as opposed to the one-liner style that uses no remote resources. Employed some Swiftisms to fulfill expectations without making the example code look weird.
Diffstat (limited to 'platform/darwin/src/MGLMapSnapshotter.h')
-rw-r--r-- | platform/darwin/src/MGLMapSnapshotter.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/platform/darwin/src/MGLMapSnapshotter.h b/platform/darwin/src/MGLMapSnapshotter.h index fc68204a7d..426ab1bb00 100644 --- a/platform/darwin/src/MGLMapSnapshotter.h +++ b/platform/darwin/src/MGLMapSnapshotter.h @@ -145,11 +145,11 @@ typedef void (^MGLMapSnapshotCompletionHandler)(MGLMapSnapshot* _Nullable snapsh let snapshotter = MGLMapSnapshotter(options: options) snapshotter.start { (snapshot, error) in - if error != nil { - // error handler - } else { - // image handler + if let error = error { + fatalError(error.localizedDescription) } + + image = snapshot?.image } ``` */ |