summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2010-11-27 16:28:14 +0000
committerCaolán McNamara <caolanm@redhat.com>2010-11-27 16:32:56 +0000
commit753e4ce5c8c659461b6604fe0e4884421aa1528b (patch)
treea80d8ea55fe17517a63da6a4bb274a2876791a14 /extensions
parent1231e74a6d5c17f91d235b1564251497fa2e3f72 (diff)
Resolves: rhbz#657628# divide by zero
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/scanner/sanedlg.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index 0ab5a1271b0f..d1e8ed07ad58 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -743,21 +743,23 @@ void SaneDlg::AcquirePreview()
maReslBox.SetValue( (ULONG)fResl );
if( mbDragEnable )
+ {
maPreviewRect = Rectangle( maTopLeft,
Size( maBottomRight.X() - maTopLeft.X(),
maBottomRight.Y() - maTopLeft.Y() )
);
+ }
else
{
Size aBMSize( maPreviewBitmap.GetSizePixel() );
- if( aBMSize.Width() > aBMSize.Height() )
+ if( aBMSize.Width() > aBMSize.Height() && aBMSize.Width() )
{
int nVHeight = (maBottomRight.X() - maTopLeft.X()) * aBMSize.Height() / aBMSize.Width();
maPreviewRect = Rectangle( Point( maTopLeft.X(), ( maTopLeft.Y() + maBottomRight.Y() )/2 - nVHeight/2 ),
Size( maBottomRight.X() - maTopLeft.X(),
nVHeight ) );
}
- else
+ else if (aBMSize.Height())
{
int nVWidth = (maBottomRight.Y() - maTopLeft.Y()) * aBMSize.Width() / aBMSize.Height();
maPreviewRect = Rectangle( Point( ( maTopLeft.X() + maBottomRight.X() )/2 - nVWidth/2, maTopLeft.Y() ),