summaryrefslogtreecommitdiffstats
path: root/src/Patchage.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-05-26 23:07:24 -0400
committerDavid Robillard <d@drobilla.net>2022-05-26 23:22:40 -0400
commit6ff13ee2a86a516f27fa80bc9253781dfd3c7787 (patch)
tree588f69eb7e18c3ef8f040dc0ff28d0de5e6f9ee4 /src/Patchage.cpp
parent4a21f42341a9195a3aab5a0281c47740c8bedbc2 (diff)
downloadpatchage-6ff13ee2a86a516f27fa80bc9253781dfd3c7787.tar.gz
patchage-6ff13ee2a86a516f27fa80bc9253781dfd3c7787.tar.bz2
patchage-6ff13ee2a86a516f27fa80bc9253781dfd3c7787.zip
Avoid potential null dereferences
As judged by GCC anyway.
Diffstat (limited to 'src/Patchage.cpp')
-rw-r--r--src/Patchage.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Patchage.cpp b/src/Patchage.cpp
index 86d5dbf..7d10abf 100644
--- a/src/Patchage.cpp
+++ b/src/Patchage.cpp
@@ -639,9 +639,11 @@ update_edge_color(GanvEdge* edge, void* data)
auto* patchage = static_cast<Patchage*>(data);
Ganv::Edge* edgemm = Glib::wrap(edge);
- auto* tail = dynamic_cast<CanvasPort*>((edgemm)->get_tail());
- if (tail) {
- edgemm->set_color(patchage->conf().get_port_color(tail->type()));
+ if (edgemm) {
+ auto* tail = dynamic_cast<CanvasPort*>((edgemm)->get_tail());
+ if (tail) {
+ edgemm->set_color(patchage->conf().get_port_color(tail->type()));
+ }
}
}