ankidroid/Anki-Android — pull request #245 by chajadan (2014-04-02 05:23:17+00:00)
Title: Guard against deck deletion crashes; speed up cram/filter deck deletion

Without this fix, the code has crashed when encountering nulls. This code path does not allow the returning of null values to the caller, so skipping nulls that cause a crash is a safe operation in that the caller is not expecting to see nulls, so to filter them out does not deprive the caller of data they intend to handle.

The point has been made (assuming nulls are always outside of expected behavior due to database "not null" constraints) that this may be at times the only place in the code that notices the aberrant behavior, since the caller may have no way to notice missing values. For this reason, the idea of reporting has come up in this context.

This change only guards against a crash here. But the code has a todo for anyone who wishes to implement a reporting scheme. I only suggest that such a scheme should not be overly aggressive, as it may lead the user to have a string of reports every time they use AnkiDroid.