From 06a66521070c2eb861a20fb328decaddaa87c4fc Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Fri, 9 Jul 2004 07:56:50 +0000 Subject: [PATCH] BRect::Intersects() should return false if the passed rect is invalid git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8359 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Rect.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/kits/interface/Rect.cpp b/src/kits/interface/Rect.cpp index 9b645cc176..fe00550d06 100644 --- a/src/kits/interface/Rect.cpp +++ b/src/kits/interface/Rect.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2003, OpenBeOS +// Copyright (c) 2001-2004, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -247,11 +247,11 @@ BRect::operator|(BRect rect) const bool BRect::Intersects(BRect rect) const { - if (!(rect.left > right || rect.right < left - || rect.top > bottom || rect.bottom < top)) - return true; - - return false; + if (!IsValid() || !rect.IsValid()) + return false; + + return !(rect.left > right || rect.right < left + || rect.top > bottom || rect.bottom < top); } //------------------------------------------------------------------------------ bool