diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-06-01 21:32:24 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2019-06-01 21:32:24 +0200 |
commit | b927e0aaf0c4bec75d0ed8da29fb06c01a1bb7db (patch) | |
tree | 05b03d78c9a4d1b1af09f5350a90e97e031a75df /src/calendar.c | |
parent | Move get-git-version to new git module. (diff) | |
download | calp-b927e0aaf0c4bec75d0ed8da29fb06c01a1bb7db.tar.gz calp-b927e0aaf0c4bec75d0ed8da29fb06c01a1bb7db.tar.xz |
Fix segfault when getting extension from file without one.
Diffstat (limited to '')
-rw-r--r-- | src/calendar.c | 6 |
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++) { |