From 27729b211206e4bc8d1db76180d028744ed8b70b Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Sat, 11 Apr 2015 01:03:44 -0700 Subject: [PATCH] Bug 1153579 - Fix -Wpointer-bool-conversion warning by removing null check of an array address. r=mstange --- widget/cocoa/nsNativeThemeCocoa.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index f07b9be58ba8..0aaf9e91ef99 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -486,7 +486,6 @@ static BOOL IsActive(nsIFrame* aFrame, BOOL aIsToolbarControl) NS_IMPL_ISUPPORTS_INHERITED(nsNativeThemeCocoa, nsNativeTheme, nsITheme) - nsNativeThemeCocoa::nsNativeThemeCocoa() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; @@ -836,6 +835,8 @@ static void DrawCellWithSnapping(NSCell *cell, // Snap to the smaller control size. controlSize = smallerControlSize; sizeIndex = smallerControlSizeIndex; + MOZ_ASSERT(sizeIndex < ArrayLength(settings.naturalSizes)); + // Resize and center the drawRect. if (sizes[sizeIndex].width) { drawRect.origin.x += ceil((destRect.size.width - sizes[sizeIndex].width) / 2); @@ -854,7 +855,8 @@ static void DrawCellWithSnapping(NSCell *cell, [cell setControlSize:controlSize]; - NSSize minimumSize = settings.minimumSizes ? settings.minimumSizes[sizeIndex] : NSZeroSize; + MOZ_ASSERT(sizeIndex < ArrayLength(settings.minimumSizes)); + const NSSize minimumSize = settings.minimumSizes[sizeIndex]; DrawCellWithScaling(cell, cgContext, drawRect, controlSize, sizes[sizeIndex], minimumSize, settings.margins, view, mirrorHorizontal);