Skip to content

Commit d7c6ef4

Browse files
committed
Fixed default return value for the drone attributes.
1 parent 4407034 commit d7c6ef4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ClientLib/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
22

33
ext {
44
PUBLISH_ARTIFACT_ID = 'dronekit-android'
5-
PUBLISH_VERSION = '2.3.12'
5+
PUBLISH_VERSION = '2.3.13'
66
PROJECT_DESCRIPTION = "Android DroneKit client library."
77
PROJECT_LABELS = ['3DR', '3DR Services', 'DroneAPI', 'Android', 'DroneKit']
88
PROJECT_LICENSES = ['Apache-2.0']
@@ -17,7 +17,7 @@ android {
1717
defaultConfig {
1818
minSdkVersion 14
1919
targetSdkVersion 21
20-
versionCode 20312
20+
versionCode 20313
2121
versionName PUBLISH_VERSION
2222
}
2323

ClientLib/src/main/java/com/o3dr/android/client/Drone.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public long getFlightTime() {
221221

222222
public <T extends Parcelable> T getAttribute(String type) {
223223
if (!isStarted() || type == null)
224-
return null;
224+
return this.getAttributeDefaultValue(type);
225225

226226
T attribute = null;
227227
Bundle carrier = null;
@@ -271,6 +271,9 @@ public void run() {
271271
}
272272

273273
private <T extends Parcelable> T getAttributeDefaultValue(String attributeType) {
274+
if(attributeType == null)
275+
return null;
276+
274277
switch (attributeType) {
275278
case AttributeType.ALTITUDE:
276279
return (T) new Altitude();

0 commit comments

Comments
 (0)