From 59bcf3c4f1f5f85765f6b9520b4e79360ae30760 Mon Sep 17 00:00:00 2001 From: Jacob Heun Date: Wed, 12 Sep 2018 15:23:25 +0200 Subject: [PATCH] fix: avoid creating a cid with a null result --- src/core/utils/with-mfs-root.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/utils/with-mfs-root.js b/src/core/utils/with-mfs-root.js index c5e32d8..60ff6ef 100644 --- a/src/core/utils/with-mfs-root.js +++ b/src/core/utils/with-mfs-root.js @@ -38,7 +38,8 @@ const withMfsRoot = (ipfs, callback) => { ], cb) } - cb(error, new CID(result)) + const cid = result ? new CID(result) : null + cb(error, cid) }) }, // Turn the Buffer into a CID