Browse Source

Guard calls to the synth_callback function, as it might be NULL.

master
Reece H. Dunn 9 years ago
parent
commit
9a03414e99
1 changed files with 4 additions and 6 deletions
  1. 4
    6
      src/libespeak-ng/speech.c

+ 4
- 6
src/libespeak-ng/speech.c View File

break; break;
usleep(10000); usleep(10000);
} }
} else {
if (synth_callback)
finished = synth_callback(NULL, 0, event_list);
}
} else if (synth_callback)
finished = synth_callback(NULL, 0, event_list);
return finished; return finished;
} }


if (finished < 0) if (finished < 0)
return ENS_AUDIO_ERROR; return ENS_AUDIO_ERROR;
#endif #endif
} else
} else if (synth_callback)
finished = synth_callback((short *)outbuf, length, event_list); finished = synth_callback((short *)outbuf, length, event_list);
if (finished) { if (finished) {
SpeakNextClause(NULL, 0, 2); // stop SpeakNextClause(NULL, 0, 2); // stop
if (dispatch_audio(NULL, 0, NULL) < 0) if (dispatch_audio(NULL, 0, NULL) < 0)
return ENS_AUDIO_ERROR; return ENS_AUDIO_ERROR;
#endif #endif
} else
} else if (synth_callback)
synth_callback(NULL, 0, event_list); // NULL buffer ptr indicates end of data synth_callback(NULL, 0, event_list); // NULL buffer ptr indicates end of data
break; break;
} }

Loading…
Cancel
Save