Skip to content

Commit 9f81708

Browse files
author
Davide Faconti
committed
merging #61
1 parent 787ffa1 commit 9f81708

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

bt_editor/sidepanel_monitor.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,35 @@ void SidepanelMonitor::on_timer()
4949
const uint32_t header_size = flatbuffers::ReadScalar<uint32_t>( buffer );
5050
const uint32_t num_transitions = flatbuffers::ReadScalar<uint32_t>( &buffer[4+header_size] );
5151

52+
// check uid in the index, if failed load tree from server
53+
try {
54+
for(size_t offset = 4; offset < header_size +4; offset +=3 )
55+
{
56+
const uint16_t uid = flatbuffers::ReadScalar<uint16_t>(&buffer[offset]);
57+
_uid_to_index.at(uid);
58+
}
59+
60+
for(size_t t=0; t < num_transitions; t++)
61+
{
62+
size_t offset = 8 + header_size + 12*t;
63+
const uint16_t uid = flatbuffers::ReadScalar<uint16_t>(&buffer[offset+8]);
64+
_uid_to_index.at(uid);
65+
}
66+
}
67+
catch( std::out_of_range& err) {
68+
qDebug() << "Reload tree from server";
69+
if( !getTreeFromServer() ) {
70+
_connected = false;
71+
ui->lineEdit->setDisabled(false);
72+
_timer->stop();
73+
connectionUpdate(false);
74+
return;
75+
}
76+
}
77+
5278
for(size_t offset = 4; offset < header_size +4; offset +=3 )
5379
{
54-
uint16_t uid = flatbuffers::ReadScalar<uint16_t>(&buffer[offset]);
80+
const uint16_t uid = flatbuffers::ReadScalar<uint16_t>(&buffer[offset]);
5581
const uint16_t index = _uid_to_index.at(uid);
5682
AbstractTreeNode* node = _loaded_tree.node( index );
5783
node->status = convert(flatbuffers::ReadScalar<Serialization::NodeStatus>(&buffer[offset+2] ));

0 commit comments

Comments
 (0)