#35 Fix AppKit crash when interrupting speech

avoid removing first string when queue already empty
This commit is contained in:
Benjamin Klum 2022-10-16 23:18:19 +02:00
parent b4f48fa439
commit 94615a254a
1 changed files with 6 additions and 4 deletions

View File

@ -46,13 +46,15 @@ impl AppKit {
) {
unsafe {
let strings: id = *this.get_ivar("strings");
let str: id = msg_send!(strings, firstObject);
let _: () = msg_send![str, release];
let _: () = msg_send!(strings, removeObjectAtIndex:0);
let count: u32 = msg_send![strings, count];
if count > 0 {
let str: id = msg_send!(strings, firstObject);
let _: BOOL = msg_send![synth, startSpeakingString: str];
let _: () = msg_send![str, release];
let _: () = msg_send!(strings, removeObjectAtIndex:0);
if count > 1 {
let str: id = msg_send!(strings, firstObject);
let _: BOOL = msg_send![synth, startSpeakingString: str];
}
}
}
}