{ SkImageDecoder::kWBMP_Format, "image/vnd.wap.wbmp" }
};
- const char* cstr = NULL;
+ const char* cstr = nullptr;
for (size_t i = 0; i < SK_ARRAY_COUNT(gMimeTypes); i++) {
if (gMimeTypes[i].fFormat == format) {
cstr = gMimeTypes[i].fMimeType;
}
}
- jstring jstr = 0;
- if (NULL != cstr) {
+ jstring jstr = nullptr;
+ if (cstr != nullptr) {
+ // NOTE: Caller should env->ExceptionCheck() for OOM
+ // (can't check for nullptr as it's a valid return value)
jstr = env->NewStringUTF(cstr);
}
return jstr;
// update options (if any)
if (options != NULL) {
+ jstring mimeType = getMimeTypeString(env, decoder->getFormat());
+ if (env->ExceptionCheck()) {
+ return nullObjectReturn("OOM in getMimeTypeString()");
+ }
env->SetIntField(options, gOptions_widthFieldID, scaledWidth);
env->SetIntField(options, gOptions_heightFieldID, scaledHeight);
- env->SetObjectField(options, gOptions_mimeFieldID,
- getMimeTypeString(env, decoder->getFormat()));
+ env->SetObjectField(options, gOptions_mimeFieldID, mimeType);
}
// if we're in justBounds mode, return now (skip the java bitmap)