[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - svx/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Tue Feb 28 08:56:37 UTC 2017
svx/source/sidebar/media/MediaPlaybackPanel.cxx | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
New commits:
commit 52b89c4764b68cd560000cec68678c8234a8a3d5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Feb 28 02:25:30 2017 +0100
mpMediaItem might be nullptr
This fixes at least two crashes reported through the crashreporter:
http://crashreport.libreoffice.org/stats/signature/avmedia::MediaItem::getTime()
http://crashreport.libreoffice.org/stats/signature/avmedia::MediaItem::getDuration()
Change-Id: I92eeca229fa46921317586d0317e9f00309e793b
Reviewed-on: https://gerrit.libreoffice.org/34710
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
(cherry picked from commit b5987a4148a10e27fe44ecf5d03e697692e07ca9)
Reviewed-on: https://gerrit.libreoffice.org/34712
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/svx/source/sidebar/media/MediaPlaybackPanel.cxx b/svx/source/sidebar/media/MediaPlaybackPanel.cxx
index 46f7645..f1e744d 100644
--- a/svx/source/sidebar/media/MediaPlaybackPanel.cxx
+++ b/svx/source/sidebar/media/MediaPlaybackPanel.cxx
@@ -118,10 +118,13 @@ void MediaPlaybackPanel::UpdateToolBoxes(MediaItem aMediaItem)
void MediaPlaybackPanel::Update()
{
- UpdateToolBoxes( *mpMediaItem );
- UpdateTimeSlider( *mpMediaItem );
- UpdateVolumeSlider( *mpMediaItem );
- UpdateTimeField( *mpMediaItem, mpMediaItem->getTime() );
+ if (mpMediaItem)
+ {
+ UpdateToolBoxes( *mpMediaItem );
+ UpdateTimeSlider( *mpMediaItem );
+ UpdateVolumeSlider( *mpMediaItem );
+ UpdateTimeField( *mpMediaItem, mpMediaItem->getTime() );
+ }
}
IMPL_LINK_NOARG( MediaPlaybackPanel, VolumeSlideHdl, Slider*, void)
@@ -135,7 +138,10 @@ IMPL_LINK_NOARG( MediaPlaybackPanel, SeekHdl, Slider*, void)
{
MediaItem aItem(SID_AVMEDIA_TOOLBOX);
aItem.setState( MediaState::Pause );
- aItem.setTime( mpTimeSlider->GetThumbPos() * mpMediaItem->getDuration() / AVMEDIA_TIME_RANGE);
+ double nTime = 0;
+ if (mpMediaItem)
+ nTime = mpTimeSlider->GetThumbPos() * mpMediaItem->getDuration() / AVMEDIA_TIME_RANGE;
+ aItem.setTime(nTime);
mpBindings->GetDispatcher()->ExecuteList(SID_AVMEDIA_TOOLBOX, SfxCallMode::RECORD, { &aItem });
mpBindings->Invalidate(SID_AVMEDIA_TOOLBOX);
}
@@ -154,7 +160,7 @@ IMPL_LINK( MediaPlaybackPanel, PlayToolBoxSelectHdl, ToolBox*, pControl, void)
{
aItem.setState( MediaState::Play );
- if( mpMediaItem->getTime() == mpMediaItem->getDuration() )
+ if( !mpMediaItem || (mpMediaItem->getTime() == mpMediaItem->getDuration() ))
aItem.setTime( 0.0 );
else
aItem.setTime( mpMediaItem->getTime());
More information about the Libreoffice-commits
mailing list