Re: [PATCH 04/12] kernel-shark: Error message if the opening of the session file fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 14, 2019 at 5:11 PM Yordan Karadzhov <ykaradzhov@xxxxxxxxxx> wrote:
>
> Here we add proper handling of the case when the loading of the
> session description file fails.
>
> Signed-off-by: Yordan Karadzhov <ykaradzhov@xxxxxxxxxx>
> ---
>  kernel-shark/src/KsMainWindow.cpp | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp
> index 91e0c9f..44221f6 100644
> --- a/kernel-shark/src/KsMainWindow.cpp
> +++ b/kernel-shark/src/KsMainWindow.cpp
> @@ -1010,7 +1010,16 @@ void KsMainWindow::loadSession(const QString &fileName)
>                 return;
>         }
>
> -       _session.importFromFile(fileName);
> +       if (!_session.importFromFile(fileName)) {
> +               QString text("Unable to open session description file ");
> +
> +               text.append(fileName);
> +               text.append(".\n");

Imo this is cleaner with string interpolation, e.g.

        QString text = QString("Unable to open session description
file %1.\n").arg(fileName);

-- Slavi

> +               _error(text, "loadSessErr1", true, true);
> +
> +               return;
> +       }
> +
>         _session.loadPlugins(kshark_ctx, &_plugins);
>
>         QString dataFile(_session.getDataFile(kshark_ctx));
> --
> 2.19.1
>




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux