Skip to content

Commit

Permalink
Fixed bug with getCurrentLayer when no current layer.
Browse files Browse the repository at this point in the history
  • Loading branch information
flintobrien committed May 1, 2016
1 parent 575a056 commit 26b7ac0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion editor/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ svgedit.draw.Drawing.prototype.getLayerName = function (i) {
* @returns {SVGGElement} The SVGGElement representing the current layer.
*/
svgedit.draw.Drawing.prototype.getCurrentLayer = function() {
return this.current_layer.getGroup();
return this.current_layer ? this.current_layer.getGroup() : null;
};

/**
Expand Down
3 changes: 2 additions & 1 deletion test/draw_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,10 @@
});

test('Test identifyLayers() with empty document', function() {
expect(10);
expect(11);

var drawing = new svgedit.draw.Drawing(svg);
equals(drawing.getCurrentLayer(), null);
// By default, an empty document gets an empty group created.
drawing.identifyLayers();

Expand Down

0 comments on commit 26b7ac0

Please sign in to comment.