mirror of https://github.com/ArduPilot/ardupilot
Log: fixed a bug where we could index outside an array
when we first start up, num_existing_logs may be zero
This commit is contained in:
parent
da800a295f
commit
ae1e1c940f
|
@ -260,7 +260,8 @@ static void start_new_log()
|
|||
end_pages[num_existing_logs - 1] = find_last_log_page(start_pages[num_existing_logs - 1]);
|
||||
}
|
||||
|
||||
if((end_pages[num_existing_logs - 1] < 4095) && (num_existing_logs < MAX_NUM_LOGS /*50*/)) {
|
||||
if(num_existing_logs == 0 ||
|
||||
((end_pages[num_existing_logs - 1] < 4095) && (num_existing_logs < MAX_NUM_LOGS /*50*/))) {
|
||||
|
||||
if(num_existing_logs > 0)
|
||||
start_pages[num_existing_logs] = end_pages[num_existing_logs - 1] + 1;
|
||||
|
|
|
@ -243,7 +243,8 @@ static void start_new_log(byte num_existing_logs)
|
|||
end_pages[num_existing_logs - 1] = find_last_log_page(start_pages[num_existing_logs - 1]);
|
||||
}
|
||||
|
||||
if(end_pages[num_existing_logs - 1] < 4095 && num_existing_logs < MAX_NUM_LOGS) {
|
||||
if(num_existing_logs == 0 ||
|
||||
(end_pages[num_existing_logs - 1] < 4095 && num_existing_logs < MAX_NUM_LOGS)) {
|
||||
if(num_existing_logs > 0)
|
||||
start_pages[num_existing_logs] = end_pages[num_existing_logs - 1] + 1;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue