From 3159a90b0aa670c7a82f931412e681d195528aab Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 14 May 2014 05:55:00 +0900 Subject: git save: don't crash if the last dive isn't in a trip The git save tries to generate a nice commit message based on the most recent dive, but stupidly didn't check whether that dive was in a trip or not, and unconditionally used the trip pointer to see if there was a trip location. Which works well enough if you always generate trips, but is an unmitigated disaster otherwise. Oops. Signed-off-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- save-git.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'save-git.c') diff --git a/save-git.c b/save-git.c index 3fd8807c6..2757757b2 100644 --- a/save-git.c +++ b/save-git.c @@ -850,7 +850,7 @@ static void create_commit_message(struct membuffer *msg) nr = dive->number; put_format(msg, "dive %d: %s", nr, location); - if (trip->location && *trip->location && strcmp(trip->location, location)) + if (trip && trip->location && *trip->location && strcmp(trip->location, location)) put_format(msg, " (%s)", trip->location); put_format(msg, "\n\n"); } -- cgit v1.2.3-70-g09d2