Fixed segfault when calculating median against empty array