Ticket #11111: 0001-Issue-11111-Division-by-zero-in-TabDecorator.patch

File 0001-Issue-11111-Division-by-zero-in-TabDecorator.patch, 1.1 KB (added by sambuddhabasu1, 9 years ago)
  • src/servers/app/decorator/TabDecorator.cpp

    From 966ff672fc69205f840f6665b85c6e7375b9e785 Mon Sep 17 00:00:00 2001
    From: Sambuddha Basu <sambuddhabasu1@gmail.com>
    Date: Thu, 29 Jan 2015 22:54:42 +0530
    Subject: [PATCH] Issue 11111 - Division by zero in TabDecorator
    
    ---
     src/servers/app/decorator/TabDecorator.cpp | 9 +++++++--
     1 file changed, 7 insertions(+), 2 deletions(-)
    
    diff --git a/src/servers/app/decorator/TabDecorator.cpp b/src/servers/app/decorator/TabDecorator.cpp
    index 0d295a0..68b781b 100644
    a b TabDecorator::_DoTabLayout()  
    406406void
    407407TabDecorator::_DistributeTabSize(float delta)
    408408{
    409     ASSERT(CountTabs() > 1);
     409    int32 tabCount = fTabList.CountItems();
     410    ASSERT(tabCount > 1);
    410411
    411412    float maxTabSize = 0;
    412413    float secMaxTabSize = 0;
    413414    int32 nTabsWithMaxSize = 0;
    414     for (int32 i = 0; i < fTabList.CountItems(); i++) {
     415    for (int32 i = 0; i < tabCount; i++) {
    415416        Decorator::Tab* tab = fTabList.ItemAt(i);
     417
     418        if (tab == NULL)
     419            continue;
     420
    416421        float tabWidth = tab->tabRect.Width();
    417422        if (int_equal(maxTabSize, tabWidth)) {
    418423            nTabsWithMaxSize++;