summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jason Sams <jsams@google.com> 2015-03-03 00:17:42 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2015-03-03 00:17:42 +0000
commitacbace5f08ed9f5a34a2c8928456e340ef1df5db (patch)
treea8c88c2bc3ff8e423a73f94bc27a9e1e20674fa5
parent0b3d04433d3647f9fecf9b6354d170dc2a20a60a (diff)
parente1bd7f766ea5477ff3ca7103655755f3234602b2 (diff)
am e1bd7f76: am 9fc6948b: am 514e0801: Merge "Fix crash when updating adapter offsets."
* commit 'e1bd7f766ea5477ff3ca7103655755f3234602b2': Fix crash when updating adapter offsets.
-rw-r--r--rs/java/android/renderscript/AllocationAdapter.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/rs/java/android/renderscript/AllocationAdapter.java b/rs/java/android/renderscript/AllocationAdapter.java
index 9e28f7c5d097..183726fb2fc6 100644
--- a/rs/java/android/renderscript/AllocationAdapter.java
+++ b/rs/java/android/renderscript/AllocationAdapter.java
@@ -72,17 +72,19 @@ public class AllocationAdapter extends Allocation {
private void updateOffsets() {
int a1 = 0, a2 = 0, a3 = 0, a4 = 0;
- if (mSelectedArray.length > 0) {
- a1 = mSelectedArray[0];
- }
- if (mSelectedArray.length > 1) {
- a2 = mSelectedArray[2];
- }
- if (mSelectedArray.length > 2) {
- a3 = mSelectedArray[2];
- }
- if (mSelectedArray.length > 3) {
- a4 = mSelectedArray[3];
+ if (mSelectedArray != null) {
+ if (mSelectedArray.length > 0) {
+ a1 = mSelectedArray[0];
+ }
+ if (mSelectedArray.length > 1) {
+ a2 = mSelectedArray[2];
+ }
+ if (mSelectedArray.length > 2) {
+ a3 = mSelectedArray[2];
+ }
+ if (mSelectedArray.length > 3) {
+ a4 = mSelectedArray[3];
+ }
}
mRS.nAllocationAdapterOffset(getID(mRS), mSelectedX, mSelectedY, mSelectedZ,
mSelectedLOD, mSelectedFace.mID, a1, a2, a3, a4);