summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-08-06 22:39:02 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-08-06 22:39:02 (GMT)
commit8bbd5527b66e1edd0a4a8a955dba095042b22f59 (patch)
treec284dfa7df635de0811f1bbd2353ae7aea21f0d9 /src/analysis
parenta02116de1290b1f5c7deda43071df762cebc9b84 (diff)
Avoid to count the matches of a non-existing pattern.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/scan/grammar.y9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/analysis/scan/grammar.y b/src/analysis/scan/grammar.y
index 9c3b08b..898b135 100644
--- a/src/analysis/scan/grammar.y
+++ b/src/analysis/scan/grammar.y
@@ -343,8 +343,13 @@ string_decl : IDENTIFIER ASSIGN PLAIN_STRING
{
GSearchPattern *__pat;
__pat = g_scan_rule_get_local_variable(*built_rule, $1.data);
- $$ = g_scan_match_counter_new(__pat);
- g_object_unref(G_OBJECT(__pat));
+ if (__pat == NULL)
+ $$ = NULL;
+ else
+ {
+ $$ = g_scan_match_counter_new(__pat);
+ g_object_unref(G_OBJECT(__pat));
+ }
}
;