]> granicus.if.org Git - re2c/commitdiff
Don't segfault if span has zero length.
authorUlya Trofimovich <skvadrik@gmail.com>
Fri, 13 Mar 2015 18:34:14 +0000 (18:34 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Fri, 13 Mar 2015 18:34:14 +0000 (18:34 +0000)
re2c/cases.cc

index 4cb50dfb0a0debbccecaf700296b64dd37bf9b0f..294f1ace8b957fbd7d8a35bb6861530560184a20 100644 (file)
@@ -3,7 +3,7 @@
 namespace re2c {
 
 Cases::Cases (const Span * span, uint span_size)
-       : def (span[span_size - 1].to)
+       : def (span_size == 0 ? NULL : span[span_size - 1].to)
        , cases (new Case[span_size])
        , cases_size (0)
 {