check that the file is in write mode
This commit is contained in:
@@ -565,6 +565,7 @@ MBTiles.prototype.putTile = function(z, x, y, data, callback) {
|
|||||||
MBTiles.prototype.putGrid = 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 (typeof callback !== 'function') throw new Error('Callback needed');
|
||||||
if (!this.open) return callback(new Error('MBTiles not yet loaded'));
|
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.
|
// Flip Y coordinate because MBTiles files are TMS.
|
||||||
y = (1 << z) - 1 - y;
|
y = (1 << z) - 1 - y;
|
||||||
|
|||||||
Reference in New Issue
Block a user