Fixed a segfault when adding files from the command line.