Skip to content

Commit

Permalink
Merge pull request #21398 from osmandapp/fix_widgets_out_of_bounds_crash
Browse files Browse the repository at this point in the history
Fix crash
  • Loading branch information
Chumva authored Nov 22, 2024
2 parents 27b47fe + 678139d commit 6273de6
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ protected void applySettings() {
updateRowWidgets(widgetInfo);
}

widgetSizePref.set(selectedWidgetSize);
if (widgetInfo != null) {
if (widgetInfo.widget instanceof ISupportWidgetResizing widgetResizing) {
widgetResizing.recreateView();
Expand All @@ -117,13 +116,19 @@ protected void applySettings() {

private void updateRowWidgets(@NonNull MapWidgetInfo widgetInfo) {
MapActivity activity = getMapActivity();
if (activity != null) {
List<Set<MapWidgetInfo>> widgets = widgetRegistry.getPagedWidgetsForPanel(activity,
appMode, widgetInfo.getWidgetPanel(), AVAILABLE_MODE | ENABLED_MODE | MATCHING_PANELS_MODE);

Set<MapWidgetInfo> rowMapWidgetsInfo = widgets.get(widgetInfo.pageIndex);
rowMapWidgetsInfo.remove(widgetInfo);
applySizeSettingToWidgetsInRow(rowMapWidgetsInfo);
if (activity == null) {
return;
}
List<Set<MapWidgetInfo>> widgets = widgetRegistry.getPagedWidgetsForPanel(activity,
appMode, widgetInfo.getWidgetPanel(), AVAILABLE_MODE | ENABLED_MODE | MATCHING_PANELS_MODE);

for (Set<MapWidgetInfo> rowMapWidgetsInfo : widgets) {
for (MapWidgetInfo info : rowMapWidgetsInfo) {
if (info == widgetInfo) {
applySizeSettingToWidgetsInRow(rowMapWidgetsInfo);
return;
}
}
}
}

Expand Down

0 comments on commit 6273de6

Please sign in to comment.