- cb(str, privdata);
- maxdepth = 0;
- sum = stats_recurse(dict->root, 0, &maxdepth);
- rb_snprintf(str, sizeof str, "%s: Objects: %d, Depth sum: %d, Avg depth: %d, Max depth: %d.", dict->id, dict->count, sum, sum / dict->count, maxdepth);
+ if (dict->count)
+ {
+ maxdepth = 0;
+ sum = stats_recurse(dict->root, 0, &maxdepth);
+ rb_snprintf(str, sizeof str, "%s: Objects: %d, Depth sum: %d, Avg depth: %d, Max depth: %d.", dict->id, dict->count, sum, sum / dict->count, maxdepth);
+ }
+ else
+ {
+ rb_snprintf(str, sizeof str, "%s: Objects: 0, Depth sum: 0, Avg depth: 0, Max depth: 0.", dict->id);
+ }
+