mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
fix memory index restore
This commit is contained in:
parent
da0f8e0b44
commit
5c19a2cda9
@ -67,7 +67,7 @@ int History::restore(
|
||||
R"SQL(
|
||||
SELECT * FROM `app_browser_main_tab_page_navigation_history__session`
|
||||
WHERE `app_browser_main_tab_page_navigation__session__id` = %d
|
||||
ORDER BY `id` DESC LIMIT 1
|
||||
ORDER BY `id` DESC
|
||||
)SQL",
|
||||
APP_BROWSER_MAIN_TAB_PAGE_NAVIGATION__SESSION__ID
|
||||
).c_str(),
|
||||
@ -79,12 +79,15 @@ int History::restore(
|
||||
|
||||
if (PREPARE_STATUS == SQLITE_OK)
|
||||
{
|
||||
// Use latest record as order
|
||||
// Reset current memory index
|
||||
index = -1;
|
||||
|
||||
// Cleanup memory vector
|
||||
memory.clear();
|
||||
|
||||
// Restore memory from database records
|
||||
while (sqlite3_step(statement) == SQLITE_ROW)
|
||||
{
|
||||
// Cleanup
|
||||
memory.clear();
|
||||
|
||||
// Restore
|
||||
memory.push_back(
|
||||
{
|
||||
@ -108,6 +111,12 @@ int History::restore(
|
||||
|
||||
// Restore children components here (on available)
|
||||
}
|
||||
|
||||
// Navigate to latest memory index on current value still not found in database
|
||||
if (index == -1)
|
||||
{
|
||||
index = memory.size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return sqlite3_finalize(
|
||||
|
Loading…
x
Reference in New Issue
Block a user