From 54af11354fe861e18426dab06c4688ccaf8c5862 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Mon, 13 Nov 2023 19:41:05 -0500 Subject: Fix problem with empty input/output --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'main.c') 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 (); -- cgit 1.4.1