Fix a crash when canceling a Zeo import.

Also apply the same fix to Dreem import.

Resolves #237.
This commit is contained in:
sawinglogz 2020-03-21 17:41:35 -04:00
parent da0b4e0a1f
commit 84a2b5cfd1
3 changed files with 15 additions and 2 deletions

View File

@ -23,6 +23,17 @@
static QSet<QString> s_unexpectedMessages; static QSet<QString> s_unexpectedMessages;
DreemLoader::DreemLoader()
{
m_type = MT_SLEEPSTAGE;
csv = nullptr;
}
DreemLoader::~DreemLoader()
{
closeCSV();
}
bool bool
DreemLoader::Detect(const QString & path) DreemLoader::Detect(const QString & path)
{ {

View File

@ -20,8 +20,8 @@ const int dreem_data_version = 2;
class DreemLoader : public MachineLoader class DreemLoader : public MachineLoader
{ {
public: public:
DreemLoader() { m_type = MT_SLEEPSTAGE; } DreemLoader();
virtual ~DreemLoader() { } virtual ~DreemLoader();
virtual bool Detect(const QString & path); virtual bool Detect(const QString & path);

View File

@ -23,6 +23,7 @@
ZEOLoader::ZEOLoader() ZEOLoader::ZEOLoader()
{ {
m_type = MT_SLEEPSTAGE; m_type = MT_SLEEPSTAGE;
csv = nullptr;
} }
ZEOLoader::~ZEOLoader() ZEOLoader::~ZEOLoader()
@ -85,6 +86,7 @@ int ZEOLoader::Open(const QString & dirpath)
int ZEOLoader::OpenFile(const QString & filename) int ZEOLoader::OpenFile(const QString & filename)
{ {
if (!openCSV(filename)) { if (!openCSV(filename)) {
closeCSV();
return -1; return -1;
} }
int count = 0; int count = 0;