mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 14:17:45 +00:00
fixed crash in recording
This commit is contained in:
@@ -2460,6 +2460,8 @@ void HistoryWidget::onRecordError() {
|
||||
}
|
||||
|
||||
void HistoryWidget::onRecordDone(QByteArray result, qint32 samples) {
|
||||
if (!_peer) return;
|
||||
|
||||
App::wnd()->activateWindow();
|
||||
int32 duration = samples / AudioVoiceMsgFrequency;
|
||||
_imageLoader.append(result, duration, _peer->id, replyToId(), ToPrepareAudio);
|
||||
@@ -2475,7 +2477,7 @@ void HistoryWidget::onRecordUpdate(qint16 level, qint32 samples) {
|
||||
_recordingAnim.start();
|
||||
_recordingSamples = samples;
|
||||
if (samples < 0 || samples >= AudioVoiceMsgFrequency * AudioVoiceMsgMaxLength) {
|
||||
stopRecording(samples > 0 && _inField);
|
||||
stopRecording(_peer && samples > 0 && _inField);
|
||||
}
|
||||
updateField();
|
||||
}
|
||||
@@ -3588,7 +3590,7 @@ void HistoryWidget::mouseReleaseEvent(QMouseEvent *e) {
|
||||
updateDragAreas();
|
||||
}
|
||||
if (_recording && cHasAudioCapture()) {
|
||||
stopRecording(_inField);
|
||||
stopRecording(_peer && _inField);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user