by Davo Smith.
An example of where it would not be null:
$entryid = required_param('entryid', PARAM_INT);
$entry = $DB->get_record('myplugin_entry', array('id' => $entryid));
That is, if you have some other data (e.g. a forum post) associated with the files. My updated version of the code may make it a bit clearer:
https://github.com/davosmith/filemanager