summaryrefslogtreecommitdiff
path: root/location.c
diff options
context:
space:
mode:
Diffstat (limited to 'location.c')
-rw-r--r--location.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/location.c b/location.c
index c5db626..481c033 100644
--- a/location.c
+++ b/location.c
@@ -8,8 +8,14 @@ static bool location_after(Location a, Location b) { /* a is after b? */
return a.pos > b.pos;
}
+static Location const LOCATION_NONE = {0};
+
/* for debugging */
static void fprint_location(FILE *out, Location location) {
+ if (!location.ctx) {
+ fprintf(out, "No location available.");
+ return;
+ }
char *str = location.ctx->str + location.pos;
char *newline = strchr(str, '\n');
if (newline) *newline = 0;