From 39dbbeccf55f953f975f61888dccfb2d14382f79 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 8 Dec 2019 20:29:06 +0100 Subject: Cleanup: Fix potential null dereferences --- src/server/events/Delta.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/server') diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 3fb60bfe..0a7b05ea 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -525,15 +525,18 @@ Delta::execute(RunContext& context) } break; case SpecialType::POLYPHONIC: { - GraphImpl* parent = reinterpret_cast(object->parent()); - if (value.get()) { - object->apply_poly(context, parent->internal_poly_process()); - } else { - object->apply_poly(context, 1); + if (object) { + if (value.get()) { + auto* parent = reinterpret_cast(object->parent()); + object->apply_poly(context, parent->internal_poly_process()); + } else { + object->apply_poly(context, 1); + } } } break; case SpecialType::POLYPHONY: - if (!_graph->apply_internal_poly(context, + if (_graph && + !_graph->apply_internal_poly(context, *_engine.buffer_factory(), *_engine.maid(), value.get())) { @@ -557,7 +560,9 @@ Delta::execute(RunContext& context) } break; case SpecialType::PRESET: - block->set_enabled(false); + if (block) { + block->set_enabled(false); + } break; case SpecialType::NONE: if (port) { -- cgit v1.2.1