fixed crash if directory has no files
[vrfileman] / src / fs.cc
index c7df966..8aec1b0 100644 (file)
--- a/src/fs.cc
+++ b/src/fs.cc
@@ -122,7 +122,7 @@ void draw_fs()
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
        int nchildren = (int)cur_node->children.size();
-       int ncols = std::min(cur_node->nfiles, max_ncols);
+       int ncols = std::max(std::min(cur_node->nfiles, max_ncols), 1);
 
        int first = start_child % ncols;
        int col = 0, row = 0;