$OpenBSD: patch-cmd-string_c,v 1.1.1.1 2017/02/16 20:06:03 jasper Exp $

From 608763a41a2437a8d3e0e54482d0b5f3d1c1e686 Mon Sep 17 00:00:00 2001
From: Nicolas Viennot <nicolas@viennot.biz>
Date: Tue, 14 Jun 2016 13:46:15 -0400
Subject: [PATCH] Attempt to fix environment related crash

--- cmd-string.c.orig	Tue Mar 29 05:30:07 2016
+++ cmd-string.c	Wed Feb  8 19:49:43 2017
@@ -307,6 +307,10 @@ cmd_string_variable(const char *s, size_t *p)
 	free(buf);
 	if (envent == NULL)
 		return (xstrdup(""));
+#ifdef TMATE
+	if (envent->value == NULL)
+		return (xstrdup(""));
+#endif
 	return (xstrdup(envent->value));
 
 error:
