Skip to content

App crashes when attempting to make an SQLite connection/statement #1

Description

@tarekjradi

Hy Ben!

I'm using your code to my project and when my table have a null value in a field, the code have a bad access at method selectMultiple in SQLiteDelegate at block :

for(int i = 0; i < colCount; i++){
[dataCols setObject:[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, i)] forKey:[NSString stringWithUTF8String:sqlite3_column_name(statement, i)]];
}

I recommend using the conditional below for fixing this problem :

for(int i = 0; i < colCount; i++){
char *sk = (char *)sqlite3_column_text(statement, i);
if (sk != nil) {
[dataCols setObject:[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, i)] forKey:[NSString stringWithUTF8String:sqlite3_column_name(statement, i)]];
}
}

thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions