Currently, if the Frame Selected operator is called (bpy.ops.view3d.view_selected) with no selection, the result is that nothing changes.
However, it is more contextually-friendly to have Frame Selected zoom out to the equivalent of Frame All when there is nothing selected - this means users can have a single keyboard shortcut that works contextually, and still have the option to frame everything without losing their selection, using the existing Frame All operator.
It seems like it would be a rare case where someone pressed the keyboard shortcut for Frame Selected and expect it to do nothing. False positives seem like a much smaller issue here than having a hotkey that does nothing when it could logically be doing something! :)
In this change, I have extracted the logic for finding the min/max bounds of all the visible objects in the scene into a helper function minmax_all_objects, that is now called from both the view3d_all_exec, and also now for the fallback case of viewselected_exec, so instead of finishing and returning without doing anything, it finds the visible bounds and continues to frame them.