summaryrefslogtreecommitdiff
path: root/src/misc
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/get-file-info.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/misc/get-file-info.ts b/src/misc/get-file-info.ts
index ce177cc53d..39ba541395 100644
--- a/src/misc/get-file-info.ts
+++ b/src/misc/get-file-info.ts
@@ -181,7 +181,16 @@ function getBlurhash(path: string): Promise<string> {
.resize(64, 64, { fit: 'inside' })
.toBuffer((err, buffer, { width, height }) => {
if (err) return reject(err);
- resolve(encode(new Uint8ClampedArray(buffer), width, height, 7, 7));
+
+ let hash;
+
+ try {
+ hash = encode(new Uint8ClampedArray(buffer), width, height, 7, 7);
+ } catch (e) {
+ return reject(e);
+ }
+
+ resolve(hash);
});
});
}