about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/store-api.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index b47376e5594a..b9939feda477 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -312,6 +312,9 @@ void Store::exportPaths(const Paths & paths,
 
 std::string ValidPathInfo::fingerprint() const
 {
+    if (narSize == 0 || narHash.type == htUnknown)
+        throw Error(format("cannot calculate fingerprint of path ‘%s’ because its size/hash is not known")
+            % path);
     return
         "1;" + path + ";"
         + printHashType(narHash.type) + ":" + printHash32(narHash) + ";"