diff --git a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp index e8579d67..f4c660e2 100644 --- a/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/cms50f37_loader.cpp @@ -460,7 +460,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes) buf[i] = (buf[i] & 0x7f) | (msb & 0x01 ? 0x80 : 0); } - quint16 pi = *(quint16*)(&buf[4]); + quint16 pi = buffer.data()[idx+4] | buffer.data()[idx+5] << 8; pulse = buf[3]; quint8 spo2 = buf[2]; diff --git a/sleepyhead/daily.cpp b/sleepyhead/daily.cpp index 4f38558b..fb11acf9 100644 --- a/sleepyhead/daily.cpp +++ b/sleepyhead/daily.cpp @@ -1470,7 +1470,8 @@ void Daily::Load(QDate date) quint32 chans = schema::SPAN | schema::FLAG | schema::MINOR_FLAG; if (p_profile->general->showUnknownFlags()) chans |= schema::UNKNOWN; - QList available = day->getSortedMachineChannels(chans); + QList available; + if (day) available.append(day->getSortedMachineChannels(chans)); for (int i=0; i < available.size(); ++i) { ChannelID code = available.at(i);