summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/asset_map.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/asset_map.cc b/src/asset_map.cc
index c1bafd92..615e1f5e 100644
--- a/src/asset_map.cc
+++ b/src/asset_map.cc
@@ -112,7 +112,13 @@ AssetMap::Asset::Asset(cxml::ConstNodePtr node, boost::filesystem::path root, dc
void
AssetMap::add_asset(string id, boost::filesystem::path path, bool pkl)
{
- _assets.push_back(Asset(id, path, pkl));
+ auto iter = std::find_if(_assets.begin(), _assets.end(), [id](Asset const& a) { return a.id() == id; });
+ if (iter == _assets.end()) {
+ _assets.push_back(Asset(id, path, pkl));
+ } else {
+ /* We already have this asset, so let's hope it's actually the same one */
+ DCP_ASSERT(iter->path() == path);
+ }
}