Avoid accessing an element of an empty vector in a log message