Skip to content

Commit

Permalink
Fixed issue #12 whereby empty watch directories cause a crash
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamrow committed May 22, 2014
1 parent ca47d28 commit a676e82
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions source/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,16 +557,21 @@ void Window::watch(const QString& str)
chosenDir.setNameFilters(filters);
QStringList dirFiles = chosenDir.entryList();

// persistent storage of filenames for status bar
displayNames = dirFiles;
if (dirFiles.length() == 0) {
qDebug() << "No .omf or .ovf files were found in the specified directory. Waiting for input.";
ui->statusbar->showMessage("No .omf or .ovf files were found in the specified directory. Waiting for input.");
} else {
// persistent storage of filenames for status bar
displayNames = dirFiles;
filenames.clear();
foreach (QString file, dirFiles) {
filenames.push_back(dirString + file);
}

foreach (QString file, dirFiles) {
filenames.push_back(dirString + file);
processFilenames();
gotoBackOfCache();
}

processFilenames();
gotoBackOfCache();

connect(watcher, SIGNAL(directoryChanged(QString)),
this, SLOT(updateWatchedFiles()));
}
Expand Down

0 comments on commit a676e82

Please sign in to comment.