mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
b simulators
got std::out_of_range on substr exception with 10 as size and this is the only place i use substr with size 10
This commit is contained in:
+15
-8
@@ -119,15 +119,22 @@ json Simulators::changed_UI_items()
|
|||||||
// Then push the ui_item at that index to the changed json
|
// Then push the ui_item at that index to the changed json
|
||||||
std::unordered_set<size_t> addedIndices;
|
std::unordered_set<size_t> addedIndices;
|
||||||
|
|
||||||
for (auto& item : diff)
|
try
|
||||||
{
|
{
|
||||||
std::string path = item["path"];
|
for (auto& item : diff)
|
||||||
size_t index = std::stoul(path.substr(10, path.find("/", 10) - 10));
|
{
|
||||||
if (addedIndices.find(index) != addedIndices.end())
|
std::string path = item["path"];
|
||||||
continue;
|
size_t index = std::stoul(path.substr(10, path.find("/", 10) - 10));
|
||||||
|
if (addedIndices.find(index) != addedIndices.end())
|
||||||
changed["event"]["UI_items"].push_back(after["UI_items"][index]);
|
continue;
|
||||||
addedIndices.insert(index);
|
|
||||||
|
changed["event"]["UI_items"].push_back(after["UI_items"][index]);
|
||||||
|
addedIndices.insert(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(const std::exception& e)
|
||||||
|
{
|
||||||
|
spdlog::error(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_before = after;
|
m_before = after;
|
||||||
|
|||||||
Reference in New Issue
Block a user