diff --git a/lib/shared_memory.cpp b/lib/shared_memory.cpp index 49a3a4b1..9af28ed8 100644 --- a/lib/shared_memory.cpp +++ b/lib/shared_memory.cpp @@ -1116,6 +1116,9 @@ namespace IPC { userConnection::userConnection(char * _data) { data = _data; + if (!data){ + WARN_MSG("userConnection created with null pointer!"); + } } unsigned long userConnection::getTrackId(size_t offset) const { diff --git a/src/input/input_buffer.cpp b/src/input/input_buffer.cpp index dea4efc1..444bce24 100644 --- a/src/input/input_buffer.cpp +++ b/src/input/input_buffer.cpp @@ -514,14 +514,18 @@ namespace Mist { nProxy.curPage.erase(tid); bufferLocations[tid].erase(bufferLocations[tid].begin()); } - if (pushLocation.count(it->first)){ - //Reset the userpage, to allow repushing from TS - IPC::userConnection userConn(pushLocation[it->first]); - for (int i = 0; i < SIMUL_TRACKS; i++){ - if (userConn.getTrackId(i) == it->first) { - userConn.setTrackId(i, 0); - userConn.setKeynum(i, 0); - break; + if (pushLocation.count(it->first)) { + // \todo Debugger says this is null sometimes. It shouldn't be. Figure out why! + // For now, this if will prevent crashes in these cases. + if (pushLocation[it->first]){ + //Reset the userpage, to allow repushing from TS + IPC::userConnection userConn(pushLocation[it->first]); + for (int i = 0; i < SIMUL_TRACKS; i++) { + if (userConn.getTrackId(i) == it->first) { + userConn.setTrackId(i, 0); + userConn.setKeynum(i, 0); + break; + } } } pushLocation.erase(it->first);