safeguard: do not read/write 0 bytes (iostream)

This commit is contained in:
Alexei Kasatkin
2014-06-05 23:14:36 +06:00
parent a32116d24c
commit b6787b0014
6 changed files with 61 additions and 18 deletions
+4 -1
View File
@@ -450,7 +450,10 @@ class StaticRTree
tree_node_file.read((char *)&tree_size, sizeof(uint32_t));
m_search_tree.resize(tree_size);
tree_node_file.read((char *)&m_search_tree[0], sizeof(TreeNode) * tree_size);
if (tree_size > 0)
{
tree_node_file.read((char *)&m_search_tree[0], sizeof(TreeNode) * tree_size);
}
tree_node_file.close();
// open leaf node file and store thread specific pointer
if (!boost::filesystem::exists(leaf_file))