Bug when loading a font?

I think I found a bug in the engine in case the json your looking for at url is not there: is it possible that :

var data = upgradeDataSchema(response);

should be after we confirm that we have data (in the !err case)? Or upgradeDataSchema should not assume that there is data in.

Thanks

var self = this;
if (path.getExtension(url.original) === ‘.json’) {
http.get(url.load, {
retry: this.retryRequests
}, function (err, response) {
var data = upgradeDataSchema(response);
if (!err) {
self._loadTextures(url.load.replace(’.json’, ‘.png’), data, function (err, textures) {
if (err) return callback(err);
callback(null, {
data: data,
textures: textures
});
});
} else {
callback(“Error loading font resource: " + url.original + " [” + err + “]”);
}
});

Fixed in https://github.com/playcanvas/engine/pull/2450

2 Likes