Skip to content

Commit ae091c0

Browse files
committed
Add safeguard in compileStandardWrapper for unlikely edge case of compile returning invalid JSON
1 parent 63c2d40 commit ae091c0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

wrapper.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,12 @@ function setupMethods (soljson) {
155155
}
156156

157157
function translateOutput (output) {
158-
output = translate.translateJsonCompilerOutput(JSON.parse(output));
158+
try {
159+
output = JSON.parse(output);
160+
} catch (e) {
161+
return formatFatalError('Compiler returned invalid JSON: ' + e.message);
162+
}
163+
output = translate.translateJsonCompilerOutput(output);
159164
if (output == null) {
160165
return formatFatalError('Failed to process output');
161166
}

0 commit comments

Comments
 (0)