From a0dfed06f11769cc6b46cd14e891ca1d1f3140c4 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 23 Jan 2016 23:39:22 +0100 Subject: [PATCH] Don't write atom to ringbuffer after it fails the initial data --- source/utils/Lv2AtomRingBuffer.hpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/utils/Lv2AtomRingBuffer.hpp b/source/utils/Lv2AtomRingBuffer.hpp index c6663f608..1a805892b 100644 --- a/source/utils/Lv2AtomRingBuffer.hpp +++ b/source/utils/Lv2AtomRingBuffer.hpp @@ -184,17 +184,15 @@ protected: bool writeAtom(const LV2_Atom* const atom, const int32_t portIndex) noexcept { - tryWrite(atom, sizeof(LV2_Atom)); - tryWrite(&portIndex, sizeof(int32_t)); - tryWrite(LV2_ATOM_BODY_CONST(atom), atom->size); + if (tryWrite(atom, sizeof(LV2_Atom)) && tryWrite(&portIndex, sizeof(int32_t))) + tryWrite(LV2_ATOM_BODY_CONST(atom), atom->size); return commitWrite(); } bool writeAtomChunk(const LV2_Atom* const atom, const void* const data, const int32_t portIndex) noexcept { - tryWrite(atom, sizeof(LV2_Atom)); - tryWrite(&portIndex, sizeof(int32_t)); - tryWrite(data, atom->size); + if (tryWrite(atom, sizeof(LV2_Atom)) && tryWrite(&portIndex, sizeof(int32_t))) + tryWrite(data, atom->size); return commitWrite(); }