android/Context: use DiscardException()

This commit is contained in:
Max Kellermann 2019-04-24 14:44:06 +02:00
parent 4d1546cb38
commit f7f858cb07
1 changed files with 2 additions and 3 deletions

View File

@ -19,6 +19,7 @@
#include "Context.hxx"
#include "java/Class.hxx"
#include "java/Exception.hxx"
#include "java/File.hxx"
#include "fs/AllocatedPath.hxx"
@ -33,10 +34,8 @@ Context::GetCacheDir(JNIEnv *env) const
assert(method);
jobject file = env->CallObjectMethod(Get(), method);
if (file == nullptr) {
env->ExceptionClear();
if (Java::DiscardException(env) || file == nullptr)
return nullptr;
}
return Java::File::ToAbsolutePath(env, file);
}