fixed crash if directory has no files
authorJohn Tsiombikas <nuclear@mutantstargoat.com>
Mon, 22 Aug 2016 11:36:10 +0000 (14:36 +0300)
committerJohn Tsiombikas <nuclear@mutantstargoat.com>
Mon, 22 Aug 2016 11:36:10 +0000 (14:36 +0300)
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;