Conversation
Coverage Report for CI Build 36016602754Coverage decreased (-0.01%) to 59.501%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions93 previously-covered lines in 2 files lost coverage.
Coverage Stats
馃挍 - Coveralls |
tomasMizera
approved these changes
Sep 29, 2026
tomasMizera
left a comment
Collaborator
There was a problem hiding this comment.
Looks good, thanks! I left a minor comment about ternary operators. Once fix, please proceed to testing without my review :)
Comment on lines
+303
to
+306
| QgsError layerError = layer->error(); | ||
| const QString reason = !layerError.isEmpty() ? layerError.summary() | ||
| : ( layer->dataProvider() ? layer->dataProvider()->error().summary() : QString() ); | ||
| CoreUtils::log( QStringLiteral( "Project load" ), QStringLiteral( "Invalid layer %1: %2" ).arg( layer->name(), reason ) ); |
Collaborator
There was a problem hiding this comment.
Let's not nest multiple ternary operators. They become quite hard to read.
Try comparing it with this
Suggested change
| QgsError layerError = layer->error(); | |
| const QString reason = !layerError.isEmpty() ? layerError.summary() | |
| : ( layer->dataProvider() ? layer->dataProvider()->error().summary() : QString() ); | |
| CoreUtils::log( QStringLiteral( "Project load" ), QStringLiteral( "Invalid layer %1: %2" ).arg( layer->name(), reason ) ); | |
| QgsError layerError = layer->error(); | |
| QString reason; | |
| if ( !layerError.isEmpty() ) | |
| { | |
| reason = layerError.summary(); | |
| } | |
| else if ( layer->dataProvider() ) | |
| { | |
| reason = layer->dataProvider()->error().summary(); | |
| } | |
| CoreUtils::log( QStringLiteral( "Project load" ), QStringLiteral( "Invalid layer %1: %2" ).arg( layer->name(), reason ) ); |
Collaborator
There was a problem hiding this comment.
I believe our code convention says that there can be only one ternary, not multiple ones nested.
Withalion
requested changes
Sep 29, 2026
Withalion
left a comment
Collaborator
There was a problem hiding this comment.
The ternary operators as mentioned by Tomas in 2 places
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 checksisValid()before querying the layer's data provider. This was the actual cause of the crash, since a broken connection still has a non-nulldataProvider().LayerDetailDatagained anisValidproperty so QML knows whether the tapped layer actually loaded, and logs the real failure reason internally (viaCoreUtils::log) without exposing it to the user.MMLayerDetailPage.qmlnow 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