mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 13:55:47 +03:00
More robust query result access if columns are missing.
This commit is contained in:
parent
9897335006
commit
3b369c8b03
1 changed files with 10 additions and 6 deletions
|
@ -396,9 +396,8 @@ csync_file_stat_t *csync_statedb_get_stat_by_hash(CSYNC *ctx, uint64_t phash) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (result->count <= 6) {
|
||||
c_strlist_destroy(result);
|
||||
return NULL;
|
||||
if (result->count < 10) {
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "WRN: Amount of result columns wrong, db version mismatch!");
|
||||
}
|
||||
/* phash, pathlen, path, inode, uid, gid, mode, modtime */
|
||||
len = strlen(result->vector[2]);
|
||||
|
@ -428,9 +427,14 @@ csync_file_stat_t *csync_statedb_get_stat_by_hash(CSYNC *ctx, uint64_t phash) {
|
|||
st->gid = atoi(result->vector[5]);
|
||||
st->mode = atoi(result->vector[6]);
|
||||
st->modtime = strtoul(result->vector[7], NULL, 10);
|
||||
st->type = atoi(result->vector[8]);
|
||||
if( result->vector[9])
|
||||
st->md5 = c_strdup( result->vector[9] );
|
||||
|
||||
if(result->count > 8 && result->vector[8]) {
|
||||
st->type = atoi(result->vector[8]);
|
||||
}
|
||||
|
||||
if(result->count > 9 && result->vector[9]) {
|
||||
st->md5 = c_strdup( result->vector[9] );
|
||||
}
|
||||
c_strlist_destroy(result);
|
||||
|
||||
return st;
|
||||
|
|
Loading…
Reference in a new issue