diff --git a/src/source/source_cache.js b/src/source/source_cache.js index a8b5af3b597..ed2f3e8ac9e 100644 --- a/src/source/source_cache.js +++ b/src/source/source_cache.js @@ -708,7 +708,7 @@ class SourceCache extends Evented { if (tile.uses > 0) return; - if (tile.hasData()) { + if (tile.hasData() && tile.state !== 'reloading') { this._cache.add(tile.tileID, tile, tile.getExpiryTimeout()); } else { tile.aborted = true; diff --git a/src/util/dispatcher.js b/src/util/dispatcher.js index bb43c1d1864..2b4fb9d112a 100644 --- a/src/util/dispatcher.js +++ b/src/util/dispatcher.js @@ -2,6 +2,7 @@ import { uniqueId, asyncAll } from './util'; import Actor from './actor'; +import assert from 'assert'; import type WorkerPool from './worker_pool'; @@ -32,12 +33,14 @@ class Dispatcher { actor.name = `Worker ${i}`; this.actors.push(actor); } + assert(this.actors.length); } /** * Broadcast a message to all Workers. */ broadcast(type: string, data: mixed, cb?: Function) { + assert(this.actors.length); cb = cb || function () {}; asyncAll(this.actors, (actor, done) => { actor.send(type, data, done); @@ -49,6 +52,7 @@ class Dispatcher { * @returns An actor object backed by a web worker for processing messages. */ getActor(): Actor { + assert(this.actors.length); this.currentActor = (this.currentActor + 1) % this.actors.length; return this.actors[this.currentActor]; }