summaryrefslogtreecommitdiff
path: root/rs/java/android/renderscript/AllocationAdapter.java
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2015-02-25 16:42:00 -0800
committerJason Sams <jsams@google.com>2015-02-25 16:42:00 -0800
commitadd04be7c8411aa5985d27d20c1c6466115d0498 (patch)
tree51fae6b9a9f75ec028f86bf166d9de15c23ae711 /rs/java/android/renderscript/AllocationAdapter.java
parent627396ac90dd4f8510e931bffb6705f41878c87a (diff)
Fix crash when updating adapter offsets.
Change-Id: I0a6923e387f9743a06cc2c4c67995a79789d4cdd
Diffstat (limited to 'rs/java/android/renderscript/AllocationAdapter.java')
-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);