[PATCH] Fix crash on empty arguments

2015-10-12 Thread sergey . starosek
From: Sergey Starosek 

Signed-off-by: Sergey Starosek 
---
 main.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/main.cpp b/main.cpp
index 71a998d..d6bbbf2 100644
--- a/main.cpp
+++ b/main.cpp
@@ -39,6 +39,9 @@ int main(int argc, char **argv)
 
for (i = 1; i < arguments.length(); i++) {
QString a = arguments.at(i);
+   if (a.isEmpty()) {
+   continue;
+   }
if (a.at(0) == '-') {
parse_argument(a.toLocal8Bit().data());
continue;
-- 
1.9.1

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: [PATCH] Fix crash on empty arguments

2015-10-12 Thread Lubomir I. Ivanov
On 12 October 2015 at 15:54,   wrote:

good catch!
i''ve ever tried passing an empty argument e.g. "".

> +   if (a.isEmpty()) {
> +   continue;
> +   }

could you please remove the extra "{" and "}" and resend the patch.
we don't add them around single line if/then/else statements.

thanks
lubomir
--
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: [PATCH] Fix crash on empty arguments

2015-10-12 Thread Lubomir I. Ivanov
On 12 October 2015 at 16:47,   wrote:
> From: Sergey Starosek 
>
> Signed-off-by: Sergey Starosek 
> ---
>  main.cpp | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/main.cpp b/main.cpp
> index 71a998d..f27a174 100644
> --- a/main.cpp
> +++ b/main.cpp
> @@ -39,6 +39,8 @@ int main(int argc, char **argv)
>
> for (i = 1; i < arguments.length(); i++) {
> QString a = arguments.at(i);
> +   if (a.isEmpty())
> +   continue;
> if (a.at(0) == '-') {
> parse_argument(a.toLocal8Bit().data());
> continue;

ACK

thanks!
lubomir
--
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


[PATCH] Fix crash on empty arguments

2015-10-12 Thread sergey . starosek
From: Sergey Starosek 

Signed-off-by: Sergey Starosek 
---
 main.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/main.cpp b/main.cpp
index 71a998d..f27a174 100644
--- a/main.cpp
+++ b/main.cpp
@@ -39,6 +39,8 @@ int main(int argc, char **argv)
 
for (i = 1; i < arguments.length(); i++) {
QString a = arguments.at(i);
+   if (a.isEmpty())
+   continue;
if (a.at(0) == '-') {
parse_argument(a.toLocal8Bit().data());
continue;
-- 
1.9.1

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface