Patch to fix bug https://issues.apache.org/bugzilla/show_bug.cgi?id=50722 (Empty trash raises exception)