From a16e21665a0e354ad87b316014e2d0fa0749b791 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Wed, 10 Oct 2018 20:14:47 -0700 Subject: [PATCH] view_layers: Initialize variables Fixes a couple spots where uninitialized variables cause unknown results. --- common/view/view_group.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/common/view/view_group.cpp b/common/view/view_group.cpp index 65526870cd..281672a84b 100644 --- a/common/view/view_group.cpp +++ b/common/view/view_group.cpp @@ -92,22 +92,17 @@ VIEW_ITEM *VIEW_GROUP::GetItem( unsigned int idx ) const const BOX2I VIEW_GROUP::ViewBBox() const { BOX2I bb; - bool first; if( !m_groupItems.size() ) { bb.SetMaximum(); - } else { + } + else + { + bb = m_groupItems[0]->ViewBBox(); + for( auto item : m_groupItems ) - { - if( first ) - { - bb = item->ViewBBox(); - first = false; - } else { - bb.Merge( item->ViewBBox() ); - } - } + bb.Merge( item->ViewBBox() ); } return bb; @@ -141,7 +136,8 @@ void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const } } - int layers[VIEW::VIEW_MAX_LAYERS], layers_count = 0; + int layers[VIEW::VIEW_MAX_LAYERS] = { 0 }; + int layers_count = 0; for( const auto& entry : layer_item_map ) {