I get the following error when I try to run my program. Any reasons why I get it? I have tried for several hours now but I give up. THANKS!
Error:
2011-03-08 19:18:29.967 iphoneApp[2561:207] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* +[NSString stringWithUTF8String:]: NULL cString'
- (AnswerDTO *)findAnswerById:(NSInteger)primary_key {
AnswerDTO *dto = [[[AnswerDTO alloc] init] autorelease];
sqlite3_stmt *statement = nil;
const char *sql = "SELECT * FROM klb_answers WHERE id = 7;";
if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) {
sqlite3_bind_int(statement, 1, primary_key);
NSInteger answerId = sqlite3_column_int(statement, ANSWER_ID);
NSInteger answerQuestionId = sqlite3_column_int(statement, ANSWER_QUESTION_ID);
NSString *answerDescription = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, ANSWER_DESCRIPTION)];
NSString *answerSerialNumber = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, ANSWER_SERIAL_NUMBER)];
NSInteger answerIsCorrect = sqlite3_column_int(statement, ANSWER_IS_CORRECT);
dto.answerID = answerId;
dto.questionID = answerQuestionId;
dto.description = answerDescription;
dto.serialNumber = answerSerialNumber;
if (answerIsCorrect == 0) {
dto.isCorrect = NO;
} else {
dto.isCorrect = YES;
}
} else {
NSLog(@"Noe feil med statementet");
}
sqlite3_finalize(statement);
return dto;
}