BugFix: Clone source failed do not crash

Clone source that lost its origin can be replaced.
This commit is contained in:
Bruno Herbelin
2023-02-16 19:15:25 +01:00
parent e2e316a079
commit 16931917b7
4 changed files with 23 additions and 13 deletions

View File

@@ -1043,11 +1043,18 @@ void ImGuiVisitor::visit (CloneSource& s)
}
// link to origin source
std::string label = std::string(s.origin()->initials()) + " - " + s.origin()->name();
if (ImGui::Button(label.c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) ))
Mixer::manager().setCurrentSource(s.origin());
ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::Text("Origin");
if ( !s.failed() ) {
std::string label = std::string(s.origin()->initials()) + " - " + s.origin()->name();
if (ImGui::Button(label.c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) ))
Mixer::manager().setCurrentSource(s.origin());
ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::Text("Origin");
}
else {
ImGuiToolkit::ButtonDisabled("No source", ImVec2(IMGUI_RIGHT_ALIGN, 0) );
ImGui::SameLine(0, IMGUI_SAME_LINE);
ImGui::Text("Origin");
}
// filter selection
std::ostringstream oss;