mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-17 11:09:37 +00:00
#35 Fix AppKit crash when interrupting speech
avoid removing first string when queue already empty
This commit is contained in:
parent
b4f48fa439
commit
94615a254a
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user