about summary refs log tree commit diff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main.c b/main.c
index 8e1a794..d8f8a4d 100644
--- a/main.c
+++ b/main.c
@@ -10,7 +10,7 @@ GtkWidget *window;
 /* Called when a file is chosen by the open menu. */
 static void set_file (GFile *file, gpointer data) {
 	char *name;
-	char buf[BUF_SIZE];
+	unsigned char buf[BUF_SIZE];
 	const char *output;
 
 	if (!file) {
@@ -26,9 +26,11 @@ static void set_file (GFile *file, gpointer data) {
 	// If the file is longer than the buffer, truncate it (which may be okay for some formats...)
 	buf[read] = '\0';
 	fclose(cfile);
+	if (read == 0) return;
 	
 	vrvToolkit_loadData(pointer, buf);
 	output = vrvToolkit_renderToSVG(pointer, 1, TRUE);
+	if(output[0] == '\0') return;
 
 	// https://stackoverflow.com/a/14123191/1861686
 	GdkPixbufLoader *loader = gdk_pixbuf_loader_new ();