database: Check if files exist before opening
This prevents an error message (and possible corruption) by continuing with the open() function even if the file doesn't exist. Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
parent
36b76dcfc3
commit
e94063473e
|
@ -45,6 +45,9 @@ void Database<T> :: load()
|
||||||
{
|
{
|
||||||
unsigned int db_size;
|
unsigned int db_size;
|
||||||
|
|
||||||
|
if (file.exists() == false)
|
||||||
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
file.open(OPEN_READ);
|
file.open(OPEN_READ);
|
||||||
} catch (int error) {
|
} catch (int error) {
|
||||||
|
|
|
@ -300026,7 +300026,6 @@ db[99999] = 100000
|
||||||
ERROR: A file with hint = FILE_TYPE_INVALID cannot be opened
|
ERROR: A file with hint = FILE_TYPE_INVALID cannot be opened
|
||||||
|
|
||||||
Test 3
|
Test 3
|
||||||
ERROR: A file with hint = FILE_TYPE_INVALID cannot be opened
|
|
||||||
|
|
||||||
Test 4
|
Test 4
|
||||||
Database size: 5
|
Database size: 5
|
||||||
|
|
Loading…
Reference in New Issue