aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-06-01 21:32:24 +0200
committerHugo Hörnquist <hugo@hornquist.se>2019-06-01 21:32:24 +0200
commitb927e0aaf0c4bec75d0ed8da29fb06c01a1bb7db (patch)
tree05b03d78c9a4d1b1af09f5350a90e97e031a75df
parentMove get-git-version to new git module. (diff)
downloadcalp-b927e0aaf0c4bec75d0ed8da29fb06c01a1bb7db.tar.gz
calp-b927e0aaf0c4bec75d0ed8da29fb06c01a1bb7db.tar.xz
Fix segfault when getting extension from file without one.
-rw-r--r--src/calendar.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/calendar.c b/src/calendar.c
index 500f0827..e634b166 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -117,6 +117,12 @@ int handle_dir(vcomponent* cal, char* path) {
}
int get_extension(const char* filename, char* ext, ssize_t max_len) {
+
+ if (filename == NULL) {
+ ext[0] = '\0';
+ return 0;
+ }
+
int ext_idx = -1;
ext[0] = '\0';
for (int i = 0; filename[i] != '\0'; i++) {