From 021fbb8ad4a3d534d25fe76c2728de9a8827bbac Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 25 Jul 2015 01:43:11 +0200 Subject: [PATCH] fixed crash in recording --- Telegram/SourceFiles/historywidget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 0bd5f65c9..ec14a0d7e 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -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); } }