Skip to content

Commit 6b819c0

Browse files
Improve behaviour for incorrect track ids
1 parent 2db4c5f commit 6b819c0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

components/com_jtg/models/track.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,6 @@ function getFile ($id)
408408
$result = $db->loadObject();
409409
$this->track = $result; // Cache track for use with edit/delete etc
410410

411-
if (! $result)
412-
{
413-
return JTable::getInstance('jtg_files', 'table');
414-
}
415-
416411
return $result;
417412
}
418413

components/com_jtg/views/track/view.html.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@ public function display($tpl = null)
200200
$document->addScript(JUri::root(true) . '/components/com_jtg/assets/js/animatedCursor.js');
201201
}
202202
$this->track = $model->getFile( $this->id );
203+
if (!$this->track) {
204+
$mainframe->enqueueMessage("Track not found id ".$this->id,'Error');
205+
$mainframe->redirect(Uri::root());
206+
return false;
207+
}
203208
$file = JPATH_SITE . '/images/jtrackgallery/uploaded_tracks/' . strtolower($this->track->file);
204209
$gpsData = new GpsDataClass($file, $this->track->file);
205210
$this->imageList = $model->getImages($this->id);
@@ -236,6 +241,7 @@ public function display($tpl = null)
236241
}
237242
else {
238243
$gpsData = new GpsDataClass;
244+
$this->tags = null;
239245
}
240246
}
241247
if (! isset($this->track) )

0 commit comments

Comments
 (0)