From 105aafbc96f70701979c33563cae45ac344b636a Mon Sep 17 00:00:00 2001
From: jp9000 <obs.jim@gmail.com>
Date: Sun, 16 Feb 2014 22:42:35 -0700
Subject: [PATCH] Fix a NULL pointer deference

Also, fixed an issue with the new conversion shader not compiling
properly on some video devices
---
 build/data/libobs/format_conversion.effect | 4 ++--
 libobs/graphics/graphics.c                 | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/build/data/libobs/format_conversion.effect b/build/data/libobs/format_conversion.effect
index 895170501..dc91edecd 100644
--- a/build/data/libobs/format_conversion.effect
+++ b/build/data/libobs/format_conversion.effect
@@ -108,12 +108,12 @@ float4 PSPlanar420(VertInOut vert_in) : TARGET
 		sample_pos[3] = float2(ch_u +  width_i2, ch_v);
 	}
 
-	float4x4 out_val = {
+	float4x4 out_val = float4x4(
 		image.Sample(def_sampler, sample_pos[0]),
 		image.Sample(def_sampler, sample_pos[1]),
 		image.Sample(def_sampler, sample_pos[2]),
 		image.Sample(def_sampler, sample_pos[3])
-	};
+	);
 
 	out_val = transpose(out_val);
 
diff --git a/libobs/graphics/graphics.c b/libobs/graphics/graphics.c
index f94ee33ac..19d82ef03 100644
--- a/libobs/graphics/graphics.c
+++ b/libobs/graphics/graphics.c
@@ -582,8 +582,9 @@ effect_t gs_create_effect(const char *effect_string, const char *filename,
 	ep_init(&parser);
 	success = ep_parse(&parser, effect, effect_string, filename);
 	if (!success) {
-		*error_string = error_data_buildstring(
-				&parser.cfp.error_list);
+		if (error_string)
+			*error_string = error_data_buildstring(
+					&parser.cfp.error_list);
 		effect_destroy(effect);
 		effect = NULL;
 	}
-- 
GitLab