Don't set asset.id to an empty string.

The `Asset` constructor sets `asset.id` to the asset's path, a sensible default. Of course, if the asset has a name instead of a path, we have to use that instead. Or if the user specified an ID, that's even better.

We just don't want to default to `""`, since then a bunch of assets could have the same ID.

Resolves #1758.
This commit is contained in:
player-03
2024-02-11 21:18:19 -05:00
committed by GitHub
parent c9605ee784
commit 76437a3014

View File

@@ -676,21 +676,18 @@ class ProjectXMLParser extends HXProject
}
}
var id = "";
var asset = new Asset(path + childPath, targetPath + childTargetPath, childType, childEmbed);
asset.library = childLibrary;
if (childElement.has.id)
{
id = substitute(childElement.att.id);
asset.id = substitute(childElement.att.id);
}
else if (childElement.has.name)
{
id = substitute(childElement.att.name);
asset.id = substitute(childElement.att.name);
}
var asset = new Asset(path + childPath, targetPath + childTargetPath, childType, childEmbed);
asset.library = childLibrary;
asset.id = id;
if (childGlyphs != null)
{
asset.glyphs = childGlyphs;