From a0c816c691ed519aafdc6f0ee43719d87c886cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Mon, 18 Jul 2011 14:21:50 +0200 Subject: [PATCH] check that the file is in write mode --- lib/mbtiles.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/mbtiles.js b/lib/mbtiles.js index a0b98d5..823ecbc 100644 --- a/lib/mbtiles.js +++ b/lib/mbtiles.js @@ -565,6 +565,7 @@ MBTiles.prototype.putTile = function(z, x, y, data, callback) { MBTiles.prototype.putGrid = function(z, x, y, data, callback) { if (typeof callback !== 'function') throw new Error('Callback needed'); if (!this.open) return callback(new Error('MBTiles not yet loaded')); + if (!this._isWritable) return callback(new Error('MBTiles not in write mode')); // Flip Y coordinate because MBTiles files are TMS. y = (1 << z) - 1 - y;