From 547f7aecc147c69ac0d002142d464be3da0c9d8e Mon Sep 17 00:00:00 2001
From: David Anderson <dvander@alliedmods.net>
Date: Sun, 26 Oct 2008 23:40:24 -0500
Subject: [PATCH] Fixed crash when using ISourcePawnEngine2::LoadPlugin with a
 non-existant file.

---
 sourcepawn/jit/engine2.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sourcepawn/jit/engine2.cpp b/sourcepawn/jit/engine2.cpp
index 25957f05..43aeff68 100644
--- a/sourcepawn/jit/engine2.cpp
+++ b/sourcepawn/jit/engine2.cpp
@@ -125,7 +125,10 @@ IPluginRuntime *SourcePawnEngine2::LoadPlugin(ICompilation *co, const char *file
 
 return_error:
 	*err = error;
-    fclose(fp);
+	if (fp != NULL)
+	{
+    	fclose(fp);
+	}
 
 	return NULL;
 }