Browse Source

Assert that similar cable does not exist in Engine::addCable()

tags/v2.5.0
Andrew Belt 8 months ago
parent
commit
9314d7a527
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      src/engine/Engine.cpp

+ 2
- 1
src/engine/Engine.cpp View File

@@ -923,6 +923,8 @@ void Engine::addCable_NoLock(Cable* cable) {
for (Cable* cable2 : internal->cables) {
// Check that the cable is not already added
assert(cable2 != cable);
// Check that cable isn't similar to another cable
assert(!(cable2->inputModule == cable->inputModule && cable2->inputId == cable->inputId && cable2->outputModule == cable->outputModule && cable2->outputId == cable->outputId));
// Check if input is already connected to a cable
if (cable2->inputModule == cable->inputModule && cable2->inputId == cable->inputId)
inputWasConnected = true;
@@ -1288,7 +1290,6 @@ void Engine::fromJson(json_t* rootJ) {
catch (Exception& e) {
WARN("Cannot load cable: %s", e.what());
delete cable;
// Don't log exceptions because missing modules create unnecessary complaining when cables try to connect to them.
continue;
}
}


Loading…
Cancel
Save