Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Fix divide-by-zero error when image has no dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Johnston committed Jan 8, 2011
1 parent ccc50dc commit a76770d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sources/ImgRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ PIE.ImgRenderer = PIE.RendererBase.newRenderer( {
},

draw: function() {
this._lastSrc = src;
this.hideActualImg();

var shape = this.getShape( 'img', 'fill', this.getBox() ),
Expand All @@ -39,7 +40,7 @@ PIE.ImgRenderer = PIE.RendererBase.newRenderer( {
shape.stroked = false;
fill.type = 'frame';
fill.src = src;
fill.position = (0.5 / w) + ',' + (0.5 / h);
fill.position = (w ? 0.5 / w : 0) + ',' + (h ? 0.5 / h : 0);
shape.coordsize = w * 2 + ',' + h * 2;
shape.coordorigin = '1,1';
shape.path = this.getBoxPath( borderWidths ? {
Expand All @@ -51,8 +52,6 @@ PIE.ImgRenderer = PIE.RendererBase.newRenderer( {
s = shape.style;
s.width = w;
s.height = h;

this._lastSrc = src;
},

hideActualImg: function() {
Expand Down

0 comments on commit a76770d

Please sign in to comment.