diff options
| author | Zach DeCook <zachdecook@librem.one> | 2023-11-13 19:41:05 -0500 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2023-11-13 19:41:05 -0500 |
| commit | 54af11354fe861e18426dab06c4688ccaf8c5862 (patch) | |
| tree | cc0132defbdf97044f33bd69c0e0128eae1d2c25 | |
| parent | e95b166f03143f488b218c385c1fcbd3be0f216c (diff) | |
| download | shemuvi-54af11354fe861e18426dab06c4688ccaf8c5862.tar.gz | |
Fix problem with empty input/output
| -rw-r--r-- | main.c | 4 |
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 (); |
