Avoid undefined url.
This commit is contained in:
@@ -173,11 +173,13 @@ OpenLayers.Control.CacheWrite = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
try {
|
try {
|
||||||
var canvasContext = tile.getCanvasContext();
|
var canvasContext = tile.getCanvasContext();
|
||||||
if (canvasContext) {
|
if (canvasContext) {
|
||||||
|
var urlMap = OpenLayers.Control.CacheWrite.urlMap;
|
||||||
|
var url = urlMap[tile.url] || tile.url;
|
||||||
window.localStorage.setItem(
|
window.localStorage.setItem(
|
||||||
"olCache_" + OpenLayers.Control.CacheWrite.urlMap[tile.url],
|
"olCache_" + url,
|
||||||
canvasContext.canvas.toDataURL(this.imageFormat)
|
canvasContext.canvas.toDataURL(this.imageFormat)
|
||||||
);
|
);
|
||||||
delete OpenLayers.Control.CacheWrite.urlMap[tile.url];
|
delete urlMap[tile.url];
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
// local storage full or CORS violation
|
// local storage full or CORS violation
|
||||||
|
|||||||
Reference in New Issue
Block a user