Fix bug where undoing+redoing AddWire multiple times crashes

This commit is contained in:
xypwn
2020-03-28 11:15:04 +01:00
parent de9e38ddf7
commit 9414c8c426
7 changed files with 28 additions and 7 deletions

View File

@@ -52,8 +52,8 @@ bool FileHandler::save(QString filename)
fOut << "[wires]\n";
for(auto wire : m_logic->m_wires)
{
auto wireInputPart = (Part*)wire->m_connectorInput->parentItem();
auto wireOutputPart = (Part*)wire->m_connectorOutput->parentItem();
auto wireInputPart = wire->m_connectorInput->parentPart();
auto wireOutputPart = wire->m_connectorOutput->parentPart();
fOut << wireInputPart << " " << wireInputPart->m_outputs.indexOf(wire->m_connectorInput) << " " << wireOutputPart << " " << wireOutputPart->m_inputs.indexOf(wire->m_connectorOutput) << "\n";
}