Skip to content

Commit

Permalink
fix empty gpx dataItem (#4213)
Browse files Browse the repository at this point in the history
  • Loading branch information
tigrim authored Dec 17, 2024
1 parent 13544ad commit cfa1d00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions Sources/Controllers/TargetMenu/GPX/OAGPXWptViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,12 @@ - (void) leftControlButtonPressed
OASGpxDataItem *gpx = [[OAGPXDatabase sharedDb] getGPXItem:[OAUtilities getGpxShortPath:self.wpt.docPath]];
OAMapPanelViewController *mapPanel = [OARootViewController instance].mapPanel;
[mapPanel targetHideMenu:0 backButtonClicked:YES onComplete:^{
auto trackItem = [[OASTrackItem alloc] initWithFile:gpx.file];
trackItem.dataItem = gpx;
[mapPanel openTargetViewWithGPX:trackItem selectedTab:EOATrackMenuHudOverviewTab selectedStatisticsTab:EOATrackMenuHudSegmentsStatisticsOverviewTab openedFromMap:YES];
if (gpx)
{
auto trackItem = [[OASTrackItem alloc] initWithFile:gpx.file];
trackItem.dataItem = gpx;
[mapPanel openTargetViewWithGPX:trackItem selectedTab:EOATrackMenuHudOverviewTab selectedStatisticsTab:EOATrackMenuHudSegmentsStatisticsOverviewTab openedFromMap:YES];
}
}];
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Helpers/OAGPXImportUIHelper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ - (void) showImportGpxAlert:(NSString *)title
[self removeFromDB];

OASGpxDataItem *gpx = [self doImport];
if (openGpxView)
if (openGpxView && gpx)
{
[self doPush];
auto trackItem = [[OASTrackItem alloc] initWithFile:gpx.file];
Expand Down

0 comments on commit cfa1d00

Please sign in to comment.