mirror of https://github.com/ArduPilot/ardupilot
StorageManager: fixed startup crash
this crash was caused by AP_UAVCAN_DNA_Server declaring a storage object on the stack, which meant file was not initialised to nullptr.
This commit is contained in:
parent
7563dcd916
commit
c35d1bd82e
|
@ -121,6 +121,9 @@ StorageAccess::StorageAccess(StorageManager::StorageType _type) :
|
||||||
{
|
{
|
||||||
// calculate available bytes
|
// calculate available bytes
|
||||||
total_size = 0;
|
total_size = 0;
|
||||||
|
#if AP_SDCARD_STORAGE_ENABLED
|
||||||
|
file = nullptr;
|
||||||
|
#endif
|
||||||
for (uint8_t i=0; i<STORAGE_NUM_AREAS; i++) {
|
for (uint8_t i=0; i<STORAGE_NUM_AREAS; i++) {
|
||||||
const StorageManager::StorageArea &area = StorageManager::layout[i];
|
const StorageManager::StorageArea &area = StorageManager::layout[i];
|
||||||
if (area.type == type) {
|
if (area.type == type) {
|
||||||
|
|
|
@ -84,6 +84,9 @@ private:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A StorageAccess object allows access to one type of storage
|
A StorageAccess object allows access to one type of storage
|
||||||
|
|
||||||
|
NOTE: this object may be declared on the stack, so it will not be
|
||||||
|
zero initialised
|
||||||
*/
|
*/
|
||||||
class StorageAccess {
|
class StorageAccess {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue