From 3dd93eb4e4b82ded4570a6baaf0a6418507144b7 Mon Sep 17 00:00:00 2001 From: Charlie Gordon Date: Sun, 3 Mar 2024 03:38:49 +0100 Subject: [PATCH] fix microbench when microbench.txt is missing (#246) --- tests/microbench.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/microbench.js b/tests/microbench.js index b70e3fb..c25e4d1 100644 --- a/tests/microbench.js +++ b/tests/microbench.js @@ -1134,11 +1134,12 @@ function load_result(filename) if (typeof std !== "undefined") { // read the file in QuickJS var f = std.open(filename, "r"); - if (!f) { + if (f) { + str = f.readAsString(); + f.close(); + } else { has_error = true; } - str = f.readAsString(); - f.close(); } else { return null; }