From 6220b88ae9eb8d7415b501376ea774ab9a134018 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 14 Mar 2016 12:58:43 +0300 Subject: [PATCH] fixed possible crash in playInline() call --- Telegram/SourceFiles/structs.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index c2f9918855..b1122e5593 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -860,14 +860,14 @@ void DocumentOpenLink::doOpen(DocumentData *data, ActionOnLoad action) { if (App::main()) App::main()->mediaMarkRead(data); } else if (data->size < MediaViewImageSizeLimit) { if (!data->data().isEmpty() && playAnimation) { - if (action == ActionOnLoadPlayInline) { + if (action == ActionOnLoadPlayInline && item->getMedia()) { item->getMedia()->playInline(item); } else { App::wnd()->showDocument(data, item); } } else if (location.accessEnable()) { - if ((App::hoveredLinkItem() || App::contextItem()) && (data->isAnimation() || QImageReader(location.name()).canRead())) { - if (action == ActionOnLoadPlayInline) { + if (item && (data->isAnimation() || QImageReader(location.name()).canRead())) { + if (action == ActionOnLoadPlayInline && item->getMedia()) { item->getMedia()->playInline(item); } else { App::wnd()->showDocument(data, item); @@ -1143,7 +1143,7 @@ void DocumentData::performActionOnLoad() { } } else if (playAnimation) { if (loaded()) { - if (_actionOnLoad == ActionOnLoadPlayInline) { + if (_actionOnLoad == ActionOnLoadPlayInline && item->getMedia()) { item->getMedia()->playInline(item); } else { App::wnd()->showDocument(this, item); @@ -1163,7 +1163,7 @@ void DocumentData::performActionOnLoad() { if (App::main()) App::main()->mediaMarkRead(this); } else if (loc.accessEnable()) { if (showImage && QImageReader(loc.name()).canRead()) { - if (_actionOnLoad == ActionOnLoadPlayInline) { + if (_actionOnLoad == ActionOnLoadPlayInline && item->getMedia()) { item->getMedia()->playInline(item); } else { App::wnd()->showDocument(this, item);