Fix enabling info widget when closing a dive

If the close action is triggered while there is no current dive (empty
history), the info widget is enabled. To avoid this behavior, we only
enable the info widget during update if the dive index is valid.

Signed-off-by: Alexandre Dupas <alexandre.dupas@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix crash when adding dive to empty dive list

Only look up the dive number of a previous dive if there is a previous
dive.

Reported-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix crash when closing the data file

Only dereference the dive pointer if there actually is a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Hack to clear the date when no dive is displayed

This mostly happens with no XML file or when closing the current XML file.
Sadly the user still can click on the empty date field (even if nothing
else is active on the screen) and a date reappears.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Disable the info widget when no dive is selected

This solves the odd case when closing the data file that clicking in the
info widget caused the input fields to respond and the little warning icon
to show up.

Also some minor whitespace cleanup for readability.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>