diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-05-01 22:56:17 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-05-01 23:03:27 +1000 |
commit | 68bfb2a082cc8def86d9706f3328d39d585eecfb (patch) | |
tree | ce66f3a115401c834950f23923c3a0f963ffd2f4 /vcl/source/outdev | |
parent | 0d0f80900db7854d31531861e0992459244d74ce (diff) |
coverity#1209550 Unchecked dynamic_cast
Dynamic cast can be dangerous - if the cast fails then it returns NULL.
Coverity picked this up - it could effect
Window::IsNativeWidgetEndabled(). Hopefully I'll get rid of this when I
remove meOutDevType during work on fdo#74702.
Change-Id: Id6df1eeff716a6acd1b108b5e1e4674e819afe3d
Diffstat (limited to 'vcl/source/outdev')
-rw-r--r-- | vcl/source/outdev/nativecontrols.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/vcl/source/outdev/nativecontrols.cxx b/vcl/source/outdev/nativecontrols.cxx index 28e2d35921f5..325320cf7e4e 100644 --- a/vcl/source/outdev/nativecontrols.cxx +++ b/vcl/source/outdev/nativecontrols.cxx @@ -32,7 +32,19 @@ static bool EnableNativeWidget( const OutputDevice& i_rDevice ) { case OUTDEV_WINDOW: - return dynamic_cast< const Window* >( &i_rDevice )->IsNativeWidgetEnabled(); + { + const Window* pWindow = dynamic_cast< const Window* >( &i_rDevice ); + if (pWindow) + { + return pWindow->IsNativeWidgetEnabled(); + } + else + { + SAL_WARN ("vcl.gdi", "Could not cast i_rDevice to Window"); + assert (pWindow); + return false; + } + } case OUTDEV_VIRDEV: { |