{"action":"created","issue":{"url":"https://api.github.com/repos/automatak/dnp3/issues/122","labels_url":"https://api.github.com/repos/automatak/dnp3/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/automatak/dnp3/issues/122/comments","events_url":"https://api.github.com/repos/automatak/dnp3/issues/122/events","html_url":"https://github.com/automatak/dnp3/issues/122","id":58032887,"number":122,"title":"Crash on trying to add event to event buffer full of other event types","user":{"login":"atmurray","id":1023496,"avatar_url":"https://avatars.githubusercontent.com/u/1023496?v=3","gravatar_id":"","url":"https://api.github.com/users/atmurray","html_url":"https://github.com/atmurray","followers_url":"https://api.github.com/users/atmurray/followers","following_url":"https://api.github.com/users/atmurray/following{/other_user}","gists_url":"https://api.github.com/users/atmurray/gists{/gist_id}","starred_url":"https://api.github.com/users/atmurray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atmurray/subscriptions","organizations_url":"https://api.github.com/users/atmurray/orgs","repos_url":"https://api.github.com/users/atmurray/repos","events_url":"https://api.github.com/users/atmurray/events{/privacy}","received_events_url":"https://api.github.com/users/atmurray/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-18T06:33:26Z","updated_at":"2015-02-18T14:10:32Z","closed_at":null,"body":"In EventBuffer.h\r\nDuring a call to EventBuffer::UpdateAny(const Event<T>& evt), when the outstation events is full of events of another type, the call to:\r\nRemoveOldestEventOfType(T::EventTypeEnum)\r\nfails and returns false. \r\n\r\nAs a result, the subsequent call to:\r\nevents.Add(SOERecord(evt.value, evt.index, evt.clazz, evt.variation))\r\nreturns a NullPtr and so:\r\nevents.Add(SOERecord(evt.value, evt.index, evt.clazz, evt.variation))->value.Reset();\r\nresults in a crash.\r\n\r\nSuggested fix:\r\nif (!RemoveOldestEventOfType(T::EventTypeEnum)) return;"},"comment":{"url":"https://api.github.com/repos/automatak/dnp3/issues/comments/74869059","html_url":"https://github.com/automatak/dnp3/issues/122#issuecomment-74869059","issue_url":"https://api.github.com/repos/automatak/dnp3/issues/122","id":74869059,"user":{"login":"jadamcrain","id":305813,"avatar_url":"https://avatars.githubusercontent.com/u/305813?v=3","gravatar_id":"","url":"https://api.github.com/users/jadamcrain","html_url":"https://github.com/jadamcrain","followers_url":"https://api.github.com/users/jadamcrain/followers","following_url":"https://api.github.com/users/jadamcrain/following{/other_user}","gists_url":"https://api.github.com/users/jadamcrain/gists{/gist_id}","starred_url":"https://api.github.com/users/jadamcrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jadamcrain/subscriptions","organizations_url":"https://api.github.com/users/jadamcrain/orgs","repos_url":"https://api.github.com/users/jadamcrain/repos","events_url":"https://api.github.com/users/jadamcrain/events{/privacy}","received_events_url":"https://api.github.com/users/jadamcrain/received_events","type":"User","site_admin":false},"created_at":"2015-02-18T14:10:32Z","updated_at":"2015-02-18T14:10:32Z","body":"Sounds like this would be easy to write a unit test for to isolate and fix.\r\n\r\nAlways easier to test the component directly than through a full integration. I can have a shot at it when I wake up a bit ;)."}}