# Buggy code
def _open_images(self):
    """Add image files from the menubar."""
    filenames, _ = QFileDialog.getOpenFileNames(
        parent=self,
        caption="Select image(s)...",
        directory=self._last_visited_dir,  # home dir by default
    )
    if filenames is not None:
        self._add_files(filenames)


# Traceback (ValueError)
WARNING: Traceback (most recent call last):
File "/home/jni/projects/napari/napari/_qt/qt_viewer.py", line 233, in _open_folder
self._add_files([folder])
File "/home/jni/projects/napari/napari/_qt/qt_viewer.py", line 247, in _add_files
self.viewer.add_image(path=filenames)
File "/home/jni/projects/napari/napari/components/viewer_model.py", line 485, in add_image
data = io.magic_imread(path)
File "/home/jni/projects/napari/napari/util/io.py", line 71, in magic_imread
image = io.imread(filename)
File "/home/jni/miniconda3/envs/f7/lib/python3.7/site-packages/skimage/io/_io.py", line 48, in imread
img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
File "/home/jni/miniconda3/envs/f7/lib/python3.7/site-packages/skimage/io/manage_plugins.py", line 210, in call_plugin
return func(*args, **kwargs)
File "/home/jni/miniconda3/envs/f7/lib/python3.7/site-packages/skimage/io/_plugins/imageio_plugin.py", line 10, in imread
return np.asarray(imageio_imread(*args, **kwargs))
File "/home/jni/miniconda3/envs/f7/lib/python3.7/site-packages/imageio/core/functions.py", line 264, in imread
reader = read(uri, format, "i", **kwargs)
File "/home/jni/miniconda3/envs/f7/lib/python3.7/site-packages/imageio/core/functions.py", line 182, in get_reader
"Could not find a format to read the specified file " "in mode %r" % mode
ValueError: Could not find a format to read the specified file in mode 'i'
WARNING:vispy:Traceback (most recent call last):
File "/home/jni/projects/napari/napari/_qt/qt_viewer.py", line 233, in _open_folder
self._add_files([folder])
File "/home/jni/projects/napari/napari/_qt/qt_viewer.py", line 247, in _add_files
self.viewer.add_image(path=filenames)
File "/home/jni/projects/napari/napari/components/viewer_model.py", line 485, in add_image
data = io.magic_imread(path)
File "/home/jni/projects/napari/napari/util/io.py", line 71, in magic_imread
image = io.imread(filename)
File "/home/jni/miniconda3/envs/f7/lib/python3.7/site-packages/skimage/io/_io.py", line 48, in imread
img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
File "/home/jni/miniconda3/envs/f7/lib/python3.7/site-packages/skimage/io/manage_plugins.py", line 210, in call_plugin
return func(*args, **kwargs)
File "/home/jni/miniconda3/envs/f7/lib/python3.7/site-packages/skimage/io/_plugins/imageio_plugin.py", line 10, in imread
return np.asarray(imageio_imread(*args, **kwargs))
File "/home/jni/miniconda3/envs/f7/lib/python3.7/site-packages/imageio/core/functions.py", line 264, in imread
reader = read(uri, format, "i", **kwargs)
File "/home/jni/miniconda3/envs/f7/lib/python3.7/site-packages/imageio/core/functions.py", line 182, in get_reader
"Could not find a format to read the specified file " "in mode %r" % mode
ValueError: Could not find a format to read the specified file in mode 'i'
Aborted (core dumped)

# Fixed code
def _open_images(self):
    """Add image files from the menubar."""
    filenames, _ = QFileDialog.getOpenFileNames(
        parent=self,
        caption="Select image(s)...",
        directory=self._last_visited_dir,  # home dir by default
    )
    if (filenames != []) and (filenames is not None):
        self._add_files(filenames)