[PATCH] Remove use of uninitialized variable nr

Dirk Hohndel dirk at hohndel.org
Sat Nov 30 07:38:30 UTC 2013


Great catch. I annotated your commit message a little bit - the code
using 'nr' was wrong in other ways, too - it still used select_dive()
and was replaced by the code a bit below that used lastDiveNr and
selectDive().

/D

On Sat, 2013-11-30 at 13:07 +0100, Anton Lundin wrote:
> nr was used but never initialized.
> 
> Signed-off-by: Anton Lundin <glance at acc.umu.se>
> ---
>  qt-ui/divelistview.cpp | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
> index d8538a5..a4d1bac 100644
> --- a/qt-ui/divelistview.cpp
> +++ b/qt-ui/divelistview.cpp
> @@ -575,7 +575,7 @@ void DiveListView::addToTripAbove()
>  
>  void DiveListView::deleteDive()
>  {
> -	int i, nr;
> +	int i;
>  	struct dive *d = (struct dive *) contextMenuIndex.data(DiveTripModel::DIVE_ROLE).value<void*>();
>  	if (!d)
>  		return;
> @@ -592,10 +592,7 @@ void DiveListView::deleteDive()
>  		lastDiveNr = i;
>  	}
>  	if (amount_selected == 0) {
> -		if (i > 0)
> -			select_dive(nr - 1);
> -		else
> -			mainWindow()->cleanUpEmpty();
> +		mainWindow()->cleanUpEmpty();
>  	}
>  	mark_divelist_changed(TRUE);
>  	mainWindow()->refreshDisplay();




More information about the subsurface mailing list