mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
fix nullpointer
This commit is contained in:
parent
7939aaaa44
commit
ee2fec1759
@ -56,8 +56,11 @@ public class OpenPgpApi {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Bundle params = new Bundle();
|
||||||
|
params.putInt(OpenPgpConstants.PARAMS_API_VERSION, OpenPgpConstants.API_VERSION);
|
||||||
|
|
||||||
// blocks until result is ready
|
// blocks until result is ready
|
||||||
Bundle result = mService.sign(null, input, output);
|
Bundle result = mService.sign(params, input, output);
|
||||||
// close() is required to halt the TransferThread
|
// close() is required to halt the TransferThread
|
||||||
output.close();
|
output.close();
|
||||||
|
|
||||||
|
@ -522,9 +522,17 @@ public class OpenPgpService extends RemoteService {
|
|||||||
public Bundle sign(Bundle params, final ParcelFileDescriptor input, final ParcelFileDescriptor output) {
|
public Bundle sign(Bundle params, final ParcelFileDescriptor input, final ParcelFileDescriptor output) {
|
||||||
final AppSettings appSettings = getAppSettings();
|
final AppSettings appSettings = getAppSettings();
|
||||||
|
|
||||||
Bundle result = new Bundle();
|
if (params == null) {
|
||||||
|
Bundle result = new Bundle();
|
||||||
|
OpenPgpError error = new OpenPgpError(OpenPgpError.GENERIC_ERROR, "params Bundle required!");
|
||||||
|
result.putParcelable(OpenPgpConstants.RESULT_ERRORS, error);
|
||||||
|
result.putInt(OpenPgpConstants.RESULT_CODE, OpenPgpConstants.RESULT_CODE_ERROR);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (params.getInt(OpenPgpConstants.PARAMS_API_VERSION) != OpenPgpConstants.API_VERSION) {
|
if (params.getInt(OpenPgpConstants.PARAMS_API_VERSION) != OpenPgpConstants.API_VERSION) {
|
||||||
// not compatible!
|
// not compatible!
|
||||||
|
Bundle result = new Bundle();
|
||||||
OpenPgpError error = new OpenPgpError(OpenPgpError.INCOMPATIBLE_API_VERSIONS, "Incompatible API versions!");
|
OpenPgpError error = new OpenPgpError(OpenPgpError.INCOMPATIBLE_API_VERSIONS, "Incompatible API versions!");
|
||||||
result.putParcelable(OpenPgpConstants.RESULT_ERRORS, error);
|
result.putParcelable(OpenPgpConstants.RESULT_ERRORS, error);
|
||||||
result.putInt(OpenPgpConstants.RESULT_CODE, OpenPgpConstants.RESULT_CODE_ERROR);
|
result.putInt(OpenPgpConstants.RESULT_CODE, OpenPgpConstants.RESULT_CODE_ERROR);
|
||||||
|
@ -56,8 +56,11 @@ public class OpenPgpApi {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Bundle params = new Bundle();
|
||||||
|
params.putInt(OpenPgpConstants.PARAMS_API_VERSION, OpenPgpConstants.API_VERSION);
|
||||||
|
|
||||||
// blocks until result is ready
|
// blocks until result is ready
|
||||||
Bundle result = mService.sign(null, input, output);
|
Bundle result = mService.sign(params, input, output);
|
||||||
// close() is required to halt the TransferThread
|
// close() is required to halt the TransferThread
|
||||||
output.close();
|
output.close();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user