In the for loop, your indexing going beyond the array index. Your loop variable i has an off-by-one error. The highest value I can have is mediaDatabase[_user].length but in the loop, i is going for one value greater than this.
Modify you code to the following code:
for (uint i = 0; i < mediaDatabase[_user].length; i++) {
recompile and run, it should work.