ericdrowell/KineticJS — pull request #159 by eduardo-matos (2012-11-16 15:19:42+00:00)
Title: Correct error when trying to get dataURL from Stage without layers

If you try to get the dataUrl from a stage whithout layers, the javascript engine will throw a `TypeError ` exception.

```javascript
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
height: 200
});

// TypeError
stage.toDataURL({
callback: function(data){ },
mimeType: 'image/png'
});
```

To fix this issue I just added a check to see if there was any layer on the stage. If there isn't any, then just return nothing (stop execution).