fixed possible crash in playInline() call

This commit is contained in:
John Preston 2016-03-14 12:58:43 +03:00
parent eb728fb36e
commit 6220b88ae9
1 changed files with 5 additions and 5 deletions

View File

@ -860,14 +860,14 @@ void DocumentOpenLink::doOpen(DocumentData *data, ActionOnLoad action) {
if (App::main()) App::main()->mediaMarkRead(data); if (App::main()) App::main()->mediaMarkRead(data);
} else if (data->size < MediaViewImageSizeLimit) { } else if (data->size < MediaViewImageSizeLimit) {
if (!data->data().isEmpty() && playAnimation) { if (!data->data().isEmpty() && playAnimation) {
if (action == ActionOnLoadPlayInline) { if (action == ActionOnLoadPlayInline && item->getMedia()) {
item->getMedia()->playInline(item); item->getMedia()->playInline(item);
} else { } else {
App::wnd()->showDocument(data, item); App::wnd()->showDocument(data, item);
} }
} else if (location.accessEnable()) { } else if (location.accessEnable()) {
if ((App::hoveredLinkItem() || App::contextItem()) && (data->isAnimation() || QImageReader(location.name()).canRead())) { if (item && (data->isAnimation() || QImageReader(location.name()).canRead())) {
if (action == ActionOnLoadPlayInline) { if (action == ActionOnLoadPlayInline && item->getMedia()) {
item->getMedia()->playInline(item); item->getMedia()->playInline(item);
} else { } else {
App::wnd()->showDocument(data, item); App::wnd()->showDocument(data, item);
@ -1143,7 +1143,7 @@ void DocumentData::performActionOnLoad() {
} }
} else if (playAnimation) { } else if (playAnimation) {
if (loaded()) { if (loaded()) {
if (_actionOnLoad == ActionOnLoadPlayInline) { if (_actionOnLoad == ActionOnLoadPlayInline && item->getMedia()) {
item->getMedia()->playInline(item); item->getMedia()->playInline(item);
} else { } else {
App::wnd()->showDocument(this, item); App::wnd()->showDocument(this, item);
@ -1163,7 +1163,7 @@ void DocumentData::performActionOnLoad() {
if (App::main()) App::main()->mediaMarkRead(this); if (App::main()) App::main()->mediaMarkRead(this);
} else if (loc.accessEnable()) { } else if (loc.accessEnable()) {
if (showImage && QImageReader(loc.name()).canRead()) { if (showImage && QImageReader(loc.name()).canRead()) {
if (_actionOnLoad == ActionOnLoadPlayInline) { if (_actionOnLoad == ActionOnLoadPlayInline && item->getMedia()) {
item->getMedia()->playInline(item); item->getMedia()->playInline(item);
} else { } else {
App::wnd()->showDocument(this, item); App::wnd()->showDocument(this, item);