QxOrm icon indicating copy to clipboard operation
QxOrm copied to clipboard

Passing null-pointer to fetch functions generates no warning

Open am-unklown opened this issue 5 years ago • 1 comments

Hello. Thank you for QxOrm)

Code like below executes without warnings. Is this expected behaviour? Maybe better to print something like "hey I cant put result into null pointer"?

// qx::dao::ptr<Something> something_ptr{new Something{}}; // when you forget about this
qx::dao::ptr<Something> something_ptr;

qx::QxSqlQuery query;
query.where("something_table.value").isEqualTo(value);

daoError = qx::dao::fetch_by_query(query, something_ptr);
if(daoError.type() != QSqlError::ErrorType::NoError){
	qWarning() << daoError.text(); // not executed
}

am-unklown avatar Aug 14 '20 10:08 am-unklown

Hello,

Maybe better to print something like "hey I cant put result into null pointer"?

Yes you are right, it would be better to add something in the output logs. I will not throw an assert or exception for that, but a trace is a good idea, thx !

QxOrm avatar Aug 20 '20 13:08 QxOrm