Fixed assert (crash) when opening a stream file saved by a newer version of Ostinato containing a new/unknown protocol
This commit is contained in:
parent
f140717f81
commit
481005a994
@ -164,6 +164,11 @@ void ProtocolManager::populateNeighbourProtocols()
|
||||
}
|
||||
}
|
||||
|
||||
bool ProtocolManager::isRegisteredProtocol(int protoNumber)
|
||||
{
|
||||
return factory.contains(protoNumber);
|
||||
}
|
||||
|
||||
AbstractProtocol* ProtocolManager::createProtocol(int protoNumber,
|
||||
StreamBase *stream, AbstractProtocol *parent)
|
||||
{
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
|
||||
void registerProtocol(int protoNumber, void *protoInstanceCreator);
|
||||
|
||||
bool isRegisteredProtocol(int protoNumber);
|
||||
AbstractProtocol* createProtocol(int protoNumber, StreamBase *stream,
|
||||
AbstractProtocol *parent = 0);
|
||||
AbstractProtocol* createProtocol(QString protoName, StreamBase *stream,
|
||||
|
@ -89,8 +89,14 @@ void StreamBase::protoDataCopyFrom(const OstProto::Stream &stream)
|
||||
iter = createProtocolListIterator();
|
||||
for (int i=0; i < stream.protocol_size(); i++)
|
||||
{
|
||||
proto = OstProtocolManager->createProtocol(
|
||||
stream.protocol(i).protocol_id().id(), this);
|
||||
int protoId = stream.protocol(i).protocol_id().id();
|
||||
|
||||
if (!OstProtocolManager->isRegisteredProtocol(protoId))
|
||||
{
|
||||
qWarning("Skipping unregistered protocol %d", protoId);
|
||||
continue;
|
||||
}
|
||||
proto = OstProtocolManager->createProtocol(protoId, this);
|
||||
proto->protoDataCopyFrom(stream.protocol(i));
|
||||
iter->insert(proto);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user