diff --git a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp index ccce8aba..14b1eb4e 100644 --- a/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/prs1_loader.cpp @@ -3167,9 +3167,9 @@ void PRS1Import::run() session->UpdateSummaries(); // Save is not threadsafe - // loader->saveMutex.lock(); + loader->saveMutex.lock(); session->Store(mach->getDataPath()); - // loader->saveMutex.unlock(); + loader->saveMutex.unlock(); // Unload them from memory session->TrashEvents(); diff --git a/sleepyhead/SleepLib/session.cpp b/sleepyhead/SleepLib/session.cpp index 187d9e2c..148faff5 100644 --- a/sleepyhead/SleepLib/session.cpp +++ b/sleepyhead/SleepLib/session.cpp @@ -1188,6 +1188,10 @@ EventDataType Session::SearchValue(ChannelID code, qint64 time, bool square) qint64 tt = time - el->first(); double i = tt / el->rate(); + if (i> cnt) { + qWarning() << "Session" << session() << "time bounds are broken.. There is a fault in the" << machine()->loaderName().toLocal8Bit.data() << "loader"; + return 0; + } int i1 = int(floor(i)); int i2 = int(ceil(i));