Skip to content

Fix app crash on selecting unavailable layer, Add info message - #4718

Open
xkello wants to merge 4 commits into
masterfrom
bugfix/fix-unavailable-layer-crash
Open

xkello wants to merge 4 commits into
masterfrom
bugfix/fix-unavailable-layer-crash

Conversation

@xkello

@xkello xkello commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Description

Tapping a layer that failed to load (bad PostGIS credentials, offline server, missing local file, etc.) crashed the app instead of telling the user anything useful.

Fixes: #4568

What changed

  • LayerFeaturesModel::populate() now checks isValid() before querying the layer's data provider. This was the actual cause of the crash, since a broken connection still has a non-null dataProvider().
  • LayerDetailData gained an isValid property so QML knows whether the tapped layer actually loaded, and logs the real failure reason internally (via CoreUtils::log) without exposing it to the user.
  • MMLayerDetailPage.qml now shows a generic "Layer unavailable" screen (with a normal header/back button) instead of building the features list and legend when the layer is invalid.
  • ActiveProject::validateProject() now logs the underlying error reason alongside the existing Project Issues entry, for easier debugging.

Behaviour

Before: tapping an unavailable layer crashed the app.
After: the user sees a "Layer unavailable" message and can navigate back normally; the specific reason (auth failure, offline, missing file, etc.) is only written to the log.

Screenshots

Before After
image IMG_4862

@xkello
xkello requested a review from Withalion September 24, 2026 15:06
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 37490167254

Coverage decreased (-0.005%) to 59.637%

Details

  • Coverage decreased (-0.005%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 101 coverage regressions across 3 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

101 previously-covered lines in 3 files lost coverage.

File Lines Losing Coverage Coverage
mm/app/activeproject.cpp 64 71.0%
mm/app/layer/layerdetaildata.cpp 36 55.74%
mm/core/merginuserinfo.cpp 1 79.08%

Coverage Stats

Coverage Status
Relevant Lines: 15757
Covered Lines: 9397
Line Coverage: 59.64%
Coverage Strength: 93.99 hits per line

馃挍 - Coveralls

@tomasMizera tomasMizera left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks! I left a minor comment about ternary operators. Once fix, please proceed to testing without my review :)

Comment thread app/activeproject.cpp

@Withalion Withalion left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ternary operators as mentioned by Tomas in 2 places

@xkello
xkello requested a review from Withalion October 1, 2026 15:57
@xkello
xkello force-pushed the bugfix/fix-unavailable-layer-crash branch from 1cc46f2 to c3c3ca0 Compare October 1, 2026 15:59
Comment thread app/layer/layerdetaildata.cpp Outdated
@Withalion

Copy link
Copy Markdown
Collaborator

And fix formatting as well.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

馃摝 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 馃摤 Mergin Maps 73891 dmg Expires: 04/01/2027 #7389
linux Build 馃摤 Mergin Maps 74151 x86_64 Expires: 04/01/2027 #7415
win64 Build 馃摤 Mergin Maps 65911 win64 Expires: 04/01/2027 #6591
Android Build 馃摤 Mergin Maps 870111 APK [armeabi-v7a] Expires: 04/01/2027 #8701
馃摤 QR code Google Play Store #8701
Android Build 馃摤 Mergin Maps 870151 APK [arm64-v8a] Expires: 04/01/2027 #8701
馃摤 QR code Google Play Store #8701
iOS Build 馃摤 Build number: 26.10.964111 #9641

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App Crashes When Selecting Layer with Failed PostGIS Connection

3 participants