summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2015-03-02 23:57:11 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-03-02 23:57:12 +0000
commit514e0801cc95c9827d220104317e1fe45f396b94 (patch)
tree536bc87395885d8df9018a76f1504444b539d8f7
parent9fc8356baa7816a13e0c140788ccf67301cbd28d (diff)
parentadd04be7c8411aa5985d27d20c1c6466115d0498 (diff)
downloadframeworks_base-514e0801cc95c9827d220104317e1fe45f396b94.zip
frameworks_base-514e0801cc95c9827d220104317e1fe45f396b94.tar.gz
frameworks_base-514e0801cc95c9827d220104317e1fe45f396b94.tar.bz2
Merge "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 9e28f7c..183726f 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);