From 5a09846a15a0cffd6ce34ee24a0c2a51886ae31d Mon Sep 17 00:00:00 2001 From: yhirose Date: Wed, 29 Jul 2015 21:47:58 -0400 Subject: [PATCH] Fixed crash problem with ast. --- peglib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/peglib.h b/peglib.h index 67b4b40..7b4c713 100644 --- a/peglib.h +++ b/peglib.h @@ -1958,14 +1958,14 @@ inline constexpr unsigned int operator "" _(const char* s, size_t) { struct Ast { Ast(const char* path, size_t line, size_t column, const char* name, const std::vector>& nodes) - : path(path), line(line), column(column), name(name), original_name(name), is_token(false), nodes(nodes) + : path(path ? path : ""), line(line), column(column), name(name), original_name(name), is_token(false), nodes(nodes) #ifdef PEGLIB_HAS_CONSTEXPR_SUPPORT , tag(str2tag(name)), original_tag(tag) #endif {} Ast(const char* path, size_t line, size_t column, const char* name, const std::string& token) - : path(path), line(line), column(column), name(name), original_name(name), is_token(true), token(token) + : path(path ? path : ""), line(line), column(column), name(name), original_name(name), is_token(true), token(token) #ifdef PEGLIB_HAS_CONSTEXPR_SUPPORT , tag(str2tag(name)), original_tag(tag) #endif