Skip to content

Commit

Permalink
Fixed crash when viewing an observation with zero photos but with sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
budowski committed Dec 14, 2023
1 parent 06c4c38 commit 54c450b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions iNaturalist/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
xmlns:tools="http://schemas.android.com/tools"
package="org.inaturalist.android"
android:installLocation="auto"
android:versionCode="596"
android:versionName="1.30.3">
android:versionCode="597"
android:versionName="1.30.4">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ public Object instantiateItem(ViewGroup container, final int position) {

if (mObsJson != null) {
try {
BetterJSONObject obsSound = new BetterJSONObject(new JSONObject(mObsJson).getJSONArray("observation_sounds").getJSONObject(position - mObservation.photos.size()));
int obsPhotoCount = mObservation.photos != null ? mObservation.photos.size() : 0;
BetterJSONObject obsSound = new BetterJSONObject(new JSONObject(mObsJson).getJSONArray("observation_sounds").getJSONObject(position - obsPhotoCount));
item = new BetterJSONObject(obsSound.getJSONObject("sound"));
isHidden = new ObservationSound(obsSound).hidden;
} catch (JSONException e) {
Expand Down

0 comments on commit 54c450b

Please sign in to comment.