From 754cd3532ac6bcf603dd624572756c385c8821db Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Wed, 29 Jan 2014 14:36:37 -0500 Subject: [PATCH] Don't crash if we can't parse the filename --- CLTool/src/tc.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CLTool/src/tc.cpp b/CLTool/src/tc.cpp index e79e66d..ae1418f 100644 --- a/CLTool/src/tc.cpp +++ b/CLTool/src/tc.cpp @@ -100,6 +100,11 @@ void ExtractBasename(const char *filename, char *buf, size_t bufSz) { } } + if(!base) { + fprintf(stderr, "Filename (%s) has no extension, we don't know how to deal with it!\n", filename); + exit(1); + } + size_t numChars = ext - base + 1; size_t toCopy = ::std::min(numChars, bufSz); memcpy(buf, base, toCopy);