[Pkg-running-devel] [openambit] 08/23: Improved robustness on faulty log-files (on disk)
Christian Perrier
bubulle at moszumanska.debian.org
Sat Jul 1 19:36:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
bubulle pushed a commit to branch master
in repository openambit.
commit 7cef5eed05dcc77a58e5098e01bf588490d73549
Author: Emil Ljungdahl <emil at kratern.se>
Date: Tue Sep 9 00:46:52 2014 +0200
Improved robustness on faulty log-files (on disk)
---
src/openambit/logstore.cpp | 2 +-
src/openambit/mainwindow.cpp | 4 +++-
src/openambit/movescount/movescount.cpp | 20 +++++++++++---------
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/openambit/logstore.cpp b/src/openambit/logstore.cpp
index a0998ba..fe03fe3 100644
--- a/src/openambit/logstore.cpp
+++ b/src/openambit/logstore.cpp
@@ -208,7 +208,7 @@ LogEntry *LogStore::readInternal(QString path)
XMLReader reader(retEntry);
if (!reader.read(&logfile)) {
QString error = reader.errorString();
- qDebug() << error;
+ qDebug() << "Failed to read " << path << ": " << error;
delete retEntry;
retEntry = NULL;
}
diff --git a/src/openambit/mainwindow.cpp b/src/openambit/mainwindow.cpp
index 714e471..38a3caf 100644
--- a/src/openambit/mainwindow.cpp
+++ b/src/openambit/mainwindow.cpp
@@ -382,7 +382,9 @@ void MainWindow::logItemSelected(QListWidgetItem *current,QListWidgetItem *previ
if (current != NULL) {
logEntry = logStore.read(current->data(Qt::UserRole).toString());
- ui->logDetail->setHtml(logEntry->toHtml());
+ if (logEntry != NULL) {
+ ui->logDetail->setHtml(logEntry->toHtml());
+ }
delete logEntry;
}
diff --git a/src/openambit/movescount/movescount.cpp b/src/openambit/movescount/movescount.cpp
index 1867f0d..6d85a8f 100644
--- a/src/openambit/movescount/movescount.cpp
+++ b/src/openambit/movescount/movescount.cpp
@@ -290,18 +290,20 @@ void MovesCount::checkUploadedLogs()
QList<LogStore::LogDirEntry> entries = logStore.dir();
foreach(LogStore::LogDirEntry entry, entries) {
LogEntry *logEntry = logStore.read(entry);
- if (logEntry->movescountId.length() == 0) {
- missingEntries.append(logEntry);
- if (logEntry->time < firstUnknown) {
- firstUnknown = logEntry->time;
+ if (logEntry != NULL) {
+ if (logEntry->movescountId.length() == 0) {
+ missingEntries.append(logEntry);
+ if (logEntry->time < firstUnknown) {
+ firstUnknown = logEntry->time;
+ }
+ if (logEntry->time > lastUnknown) {
+ lastUnknown = logEntry->time;
+ }
}
- if (logEntry->time > lastUnknown) {
- lastUnknown = logEntry->time;
+ else {
+ delete logEntry;
}
}
- else {
- delete logEntry;
- }
}
if (missingEntries.count() > 0) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-running/openambit.git
More information about the Pkg-running-devel
mailing list