From bb7177dcfbb8ba1155496270d85e80678842e7ac Mon Sep 17 00:00:00 2001
From: Rodrigo Braz Monteiro <zeratul@cellosoft.com>
Date: Thu, 6 Mar 2008 21:38:40 +0000
Subject: [PATCH] Fixed #662, that resulted in crashes when trying to load an
 empty avs file.

Originally committed to SVN as r1927.
---
 aegisub/video_provider_avs.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/aegisub/video_provider_avs.cpp b/aegisub/video_provider_avs.cpp
index c1a07017e..b7f39a3a3 100644
--- a/aegisub/video_provider_avs.cpp
+++ b/aegisub/video_provider_avs.cpp
@@ -280,7 +280,7 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori
 	}
 
 	// Check if video was loaded properly
-	if (!script.AsClip()->GetVideoInfo().HasVideo()) {
+	if (!script.IsClip() || !script.AsClip()->GetVideoInfo().HasVideo()) {
 		AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: No suitable video found"));
 		throw _T("Avisynth: No usable video found in ") + _filename;
 	}