From 99f6ea8934fa9fa087c7351010c85a0b712a9047 Mon Sep 17 00:00:00 2001 From: Matt Sprague Date: Fri, 25 May 2018 15:48:32 -0700 Subject: [PATCH] Map constructor should fail if WebGL init fails. --- src/ui/map.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ui/map.js b/src/ui/map.js index 9571fb28b99..af90c38d415 100755 --- a/src/ui/map.js +++ b/src/ui/map.js @@ -339,6 +339,9 @@ class Map extends Camera { this._setupContainer(); this._setupPainter(); + if (this.painter === undefined) { + throw new Error(`Failed to initialize WebGL.`); + } this.on('move', this._update.bind(this, false)); this.on('zoom', this._update.bind(this, true));