Avoid segfault if parser `ref' is empty

This commit is contained in:
Andrew Hutchings 2015-11-17 11:11:03 -03:00 committed by Felipe Zimmerle
parent f65b08b066
commit c035e76ede
3 changed files with 5 additions and 11 deletions

View File

@ -19,12 +19,12 @@ GEOIP_CPPFLAGS=""
GEOIP_LDADD=""
GEOIP_LDFLAGS=""
GEOIP_CONFIG=${PKG_CONFIG}
GEOIP_PKGNAMES="geoip2 geoip GeoIP libGeoIP"
GEOIP_PKGNAMES="geoip2 geoip GeoIP"
GEOIP_SONAMES="so la sl dll dylib"
AC_ARG_WITH(
geoip,
[AC_HELP_STRING([--with-geoip=PATH],[Path to geoip prefix])]
[AC_HELP_STRING([--with-geoip=PATH],[Path to geoip prefix or config script])]
,, with_geoip=yes)
AS_CASE(["${with_geoip}"],

View File

@ -167,7 +167,9 @@ void Driver::error(const yy::location& l, const std::string& m,
const std::string& c) {
if (parserError.tellp() == 0) {
parserError << "Rules error. ";
parserError << "File: " << ref.back() << ". ";
if (ref.empty() == false) {
parserError << "File: " << ref.back() << ". ";
}
parserError << "Line: " << l.end.line << ". ";
parserError << "Column: " << l.end.column << ". ";
}

View File

@ -1,8 +0,0 @@
#include <stdio.h>
int main(int argc, char **argv) {
return 0;
}