changeset 4455:97f8ae90566a

graph: handle failing canvas creation Seen randomly when PR had "No changesets" or when reloading while the changelog + graph was loading.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 21 Aug 2014 23:46:55 +0200
parents 9cfc66a665ae
children 43cafe348c9a
files kallithea/public/js/graph.js
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/public/js/graph.js	Thu Aug 21 23:46:55 2014 +0200
+++ b/kallithea/public/js/graph.js	Thu Aug 21 23:46:55 2014 +0200
@@ -29,6 +29,10 @@
 	
 	if (!document.createElement("canvas").getContext)
 		this.canvas = window.G_vmlCanvasManager.initElement(this.canvas);
+	if (!this.canvas) { // canvas creation did for some reason fail - fail silently
+		this.render = function(data,canvasWidth) {};
+		return;
+	}
 	this.ctx = this.canvas.getContext('2d');
 	this.ctx.strokeStyle = 'rgb(0, 0, 0)';
 	this.ctx.fillStyle = 'rgb(0, 0, 0)';