# HG changeset patch # User Mads Kiilerich # Date 2014-08-21 23:46:55 # Node ID 97f8ae90566af207d283e56d70d22a3ea3735f41 # Parent 9cfc66a665aed53cd46bdbad91dba832cf84aef6 graph: handle failing canvas creation Seen randomly when PR had "No changesets" or when reloading while the changelog + graph was loading. diff --git a/kallithea/public/js/graph.js b/kallithea/public/js/graph.js --- a/kallithea/public/js/graph.js +++ b/kallithea/public/js/graph.js @@ -29,6 +29,10 @@ function BranchRenderer(canvas_id, conte 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)';