[PATCH] Only add non-blank cylinder strings to the cylinder list

Lubomir I. Ivanov neolit123 at gmail.com
Mon Jul 18 16:33:12 PDT 2016


On 19 July 2016 at 02:06, Tim Wootton <tim at tee-jay.org.uk> wrote:
> Signed-off-by: Tim Wootton <tim at tee-jay.org.uk>
> ---
>  core/subsurface-qt/DiveObjectHelper.cpp | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp
> index 1c7621e..c246a12 100644
> --- a/core/subsurface-qt/DiveObjectHelper.cpp
> +++ b/core/subsurface-qt/DiveObjectHelper.cpp
> @@ -255,8 +255,12 @@ QString DiveObjectHelper::cylinderList() const
>  QStringList DiveObjectHelper::cylinders() const
>  {
>         QStringList cylinders;
> -       for (int i = 0; i < MAX_CYLINDERS; i++)
> -               cylinders << getFormattedCylinder(m_dive, i);
> +       for (int i = 0; i < MAX_CYLINDERS; i++) {
> +               QString cyl = getFormattedCylinder(m_dive, i);
> +               if (cyl == EMPTY_DIVE_STRING)
> +                       continue;
> +               cylinders << cyl;
> +       }
>         return cylinders;
>  }
>

you can also the fix for DiveObjectHelper::weights() in the same patch
as it works the same way as DiveObjectHelper::cylinders().

lubomir
--


More information about the subsurface mailing list