Skip to content

Commit

Permalink
Loading an empty array of textures is a no-op
Browse files Browse the repository at this point in the history
Removes need for deathcap/voxel-engine@c674690
Allows dynamically loading textures after initialization
  • Loading branch information
deathcap committed Dec 12, 2013
1 parent 31823dd commit fd5b723
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ function Texture(game, opts) {
}

Texture.prototype.load = function(names, done) {
if (!names || names.length === 0) return;

var self = this;
if (!Array.isArray(names)) names = [names];
done = done || function() {};
Expand Down Expand Up @@ -416,6 +418,8 @@ function TextureSimple(game, opts) {
}

TextureSimple.prototype.load = function(names, opts) {
if (!names || names.length === 0) return;

var self = this;
opts = self._options(opts);
if (!Array.isArray(names)) names = [names];
Expand Down

0 comments on commit fd5b723

Please sign in to comment.