thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', src\interface.rs:488:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: Command failed: mathcat.exe <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mi><mglyph fontfamily="my-braid-font" index="2" alt="23braid"/></mi><mo>+</mo><mi><mglyph fontfamily="my-braid-font" index="5" alt="132braid"/></mi><mo>=</mo><mi><mglyph fontfamily="my-braid-font" index="3" alt="13braid"/></mi></mrow></math>
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', src\interface.rs:488:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
at checkExecSyncError (node:child_process:828:11)
at execFileSync (node:child_process:863:15)
at callMathCAT (C:\Users\richw\dev\brailleMathTests\main2-tests0001b-0.1.23.js:78:24)
at getMathResults (C:\Users\richw\dev\brailleMathTests\main2-tests0001b-0.1.23.js:116:32) {
status: 101,
signal: null,
output: [
null,
'',
"thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', src\\interface.rs:488:27\n" +
'note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n'
],
pid: 28304,
stdout: '',
stderr: "thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', src\\interface.rs:488:27\n" +
'note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n'
}
Generating program
When fed to mathcat.exe built from MathCAT 0.1.23 with main.rs of:
// *** MathCAT doesn't normally want to build a binary ***
// *** This file is here because it is useful for trying out things ***
fn main() {
use libmathcat::interface::*;
use std::env;
let args: Vec<String> = env::args().collect();
let expr = &args[1];
let rules_dir = std::env::current_exe().unwrap().parent().unwrap().join("./Rules");
let rules_dir = rules_dir.as_os_str().to_str().unwrap().to_string();
if let Err(e) = set_rules_dir(rules_dir) {
panic!("Error: exiting -- {}", errors_to_string(&e)); }
if let Err(e) = set_mathml(expr.to_string()) {
panic!("Error: exiting -- {}", errors_to_string(&e));
};
set_preference("TTS".to_string(), "none".to_string()).unwrap();
set_preference("Impairment".to_string(), "Blindness".to_string()).unwrap();
set_preference("Language".to_string(), "en".to_string()).unwrap();
set_preference("SpeechSound".to_string(), "None".to_string()).unwrap();
set_preference("Verbosity".to_string(), "Verbose".to_string()).unwrap();
set_preference("MathRate".to_string(), "100".to_string()).unwrap();
set_preference("SpeechStyle".to_string(), "ClearSpeak".to_string()).unwrap();
set_preference("SubjectArea".to_string(), "General".to_string()).unwrap();
set_preference("Chemistry".to_string(), "SpellOut".to_string()).unwrap();
set_preference("BrailleCode".to_string(), "Nemeth".to_string()).unwrap();
let mut json_string = String::new();
json_string.push_str("{ version:'");
json_string.push_str(&get_version());
json_string.push_str("', clearspeak:'");
match get_spoken_text() {
Ok(speech) => json_string.push_str(&speech),
Err(_e) => json_string.push_str("ERROR"),
}
json_string.push_str("', braille:'");
set_preference("BrailleCode".to_string(), "Nemeth".to_string()).unwrap();
match get_braille("".to_string()) {
Ok(braille) => json_string.push_str(&braille),
Err(_e) => json_string.push_str("ERROR"),
}
json_string.push_str("'}");
println!("{}", json_string);
}
Source MathML
The following MathML generated an 'index out of bounds' panic in interface.rs:
Error Received:
Generating program
When fed to mathcat.exe built from MathCAT 0.1.23 with main.rs of: