Only operate on non-empty input

This commit is contained in:
n1073645 2020-04-17 15:11:25 +01:00
parent b950364606
commit 329d9a1c90

View file

@ -35,22 +35,23 @@ class XMLValidator extends Operation {
*/ */
run(input, args) { run(input, args) {
try { if (input)
// Overwrite error handler since the built-in one does not raise exceptions. try {
(new DOMParser.DOMParser({errorHandler: { // Overwrite error handler since the built-in one does not raise exceptions.
warning: (msg) => { (new DOMParser.DOMParser({errorHandler: {
throw new OperationError(msg); warning: (msg) => {
}, throw new OperationError(msg);
error: (msg) => { },
throw new OperationError(msg); error: (msg) => {
}, throw new OperationError(msg);
fatalError: (msg) => { },
throw new OperationError(msg); fatalError: (msg) => {
}, throw new OperationError(msg);
}})).parseFromString(input); },
} catch (err) { }})).parseFromString(input);
throw new OperationError(err); } catch (err) {
} throw new OperationError(err);
}
return input; return input;
} }
} }