Skip to content

Commit

Permalink
#1320 - crash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
budowski committed Jan 7, 2024
1 parent c17d70f commit cae852a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 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="597"
android:versionName="1.30.4">
android:versionCode="599"
android:versionName="1.30.6">

<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 @@ -463,9 +463,13 @@ public Object instantiateItem(ViewGroup container, final int position) {
if (mObsJson != null) {
try {
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;
JSONArray obsSounds = new JSONObject(mObsJson).getJSONArray("observation_sounds");

if ((position - obsPhotoCount < obsSounds.length()) && (position - obsPhotoCount >= 0)) {
BetterJSONObject obsSound = new BetterJSONObject(obsSounds.getJSONObject(position - obsPhotoCount));
item = new BetterJSONObject(obsSound.getJSONObject("sound"));
isHidden = new ObservationSound(obsSound).hidden;
}
} catch (JSONException e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit cae852a

Please sign in to comment.