diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-10-21 14:26:05 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-10-30 08:13:30 +0100 |
commit | 40043080bc5b51db9614aa06486a520c89b6743b (patch) | |
tree | 79cacb769e2d5352fc580cb6e8b8ca1daf0a7e36 /vcl | |
parent | 6e1c66182361eaea7857d61d14818fad77061d54 (diff) |
vcl button: Avoid a potential crash.
Change-Id: I09d0777ef51045054b8e3bc88aba9fb025e6f9ff
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/builder.cxx | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index e1e70c603300..f8fad60ec7c9 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2149,19 +2149,22 @@ Image VclBuilder::getCommandImage(const OUString& rCommand, bool bLarge, uno::Reference<frame::XModel> xModel(xController->getModel()); uno::Reference<ui::XUIConfigurationManagerSupplier> xSupplier(xModel, uno::UNO_QUERY); - uno::Reference<ui::XUIConfigurationManager> xDocUICfgMgr(xSupplier->getUIConfigurationManager(), uno::UNO_QUERY); - uno::Reference<ui::XImageManager> xDocImgMgr(xDocUICfgMgr->getImageManager(), uno::UNO_QUERY); + if (xSupplier.is()) + { + uno::Reference<ui::XUIConfigurationManager> xDocUICfgMgr(xSupplier->getUIConfigurationManager(), uno::UNO_QUERY); + uno::Reference<ui::XImageManager> xDocImgMgr(xDocUICfgMgr->getImageManager(), uno::UNO_QUERY); - uno::Sequence< uno::Reference<graphic::XGraphic> > aGraphicSeq; - uno::Sequence<OUString> aImageCmdSeq(1); - aImageCmdSeq[0] = rCommand; + uno::Sequence< uno::Reference<graphic::XGraphic> > aGraphicSeq; + uno::Sequence<OUString> aImageCmdSeq(1); + aImageCmdSeq[0] = rCommand; - aGraphicSeq = xDocImgMgr->getImages( nImageType, aImageCmdSeq ); - uno::Reference<graphic::XGraphic> xGraphic = aGraphicSeq[0]; - Image aImage(xGraphic); + aGraphicSeq = xDocImgMgr->getImages( nImageType, aImageCmdSeq ); + uno::Reference<graphic::XGraphic> xGraphic = aGraphicSeq[0]; + Image aImage(xGraphic); - if (!!aImage) - return aImage; + if (!!aImage) + return aImage; + } } catch (uno::Exception&) { |