Переглянути джерело

Fix status check for correct end of sequence

Martin Duquesnoy 12 роки тому
батько
коміт
6cae9e0465
1 змінених файлів з 5 додано та 4 видалено
  1. 5 4
      src/status.c

+ 5 - 4
src/status.c

@@ -102,11 +102,12 @@ status_parse(struct status_ctx *ctx)
 
           p = ++dstr;
 
-          /* Search end of sequence (] without \ behind) */
-          for(end = strchr(p, ']'); *(end - 1) == '\\';)
-               end = strchr(end + 1, ']');
+          /* Search for correct end of sequence (] without \ behind) */
+          if((end = strchr(p, ']')))
+               while(*(end - 1) == '\\')
+                    end = strchr(end + 1, ']');
 
-          if(!(strchr("sRi", *p)) || !end )
+          if(!(strchr("sRi", *p)) || !end)
                continue;
 
           /* Then parse & list it */