summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220>2015-06-28 21:57:52 +0000
committermdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220>2015-06-28 21:57:52 +0000
commit286ef6ea9dc287e0177ab9dea987e1cd8c9b911d (patch)
tree0e5acb4d16384ec18bd1a65a1a6dc62a173ce1f7
parent3a70d69878bdb3d9bc615b060819d63420c76f24 (diff)
downloadnavit-svn-286ef6ea9dc287e0177ab9dea987e1cd8c9b911d.tar.gz
Fix:core:Do not crash when attempting to set log_gpx_desc, also enable position marking with any vehicle. Fixes http://forum.navit-project.org/viewtopic.php?f=12&t=567, related to #542.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@6123 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r--navit/vehicle.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/navit/vehicle.c b/navit/vehicle.c
index f0ca8cd8..be8bd1bd 100644
--- a/navit/vehicle.c
+++ b/navit/vehicle.c
@@ -212,15 +212,15 @@ int
vehicle_get_attr(struct vehicle *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
{
int ret;
+ if (type == attr_log_gpx_desc) {
+ attr->u.str = this_->gpx_desc;
+ return 1;
+ }
if (this_->meth.position_attr_get) {
ret=this_->meth.position_attr_get(this_->priv, type, attr);
if (ret)
return ret;
}
- if (type == attr_log_gpx_desc) {
- attr->u.str = this_->gpx_desc;
- return 1;
- }
return attr_generic_get_attr(this_->attrs, NULL, type, attr, iter);
}
@@ -235,16 +235,15 @@ int
vehicle_set_attr(struct vehicle *this_, struct attr *attr)
{
int ret=1;
- if (this_->meth.set_attr)
+ if (attr->type == attr_log_gpx_desc) {
+ g_free(this_->gpx_desc);
+ this_->gpx_desc = g_strdup(attr->u.str);
+ } else if (this_->meth.set_attr)
ret=this_->meth.set_attr(this_->priv, attr);
/* attr_profilename probably is never used by vehicle itself but it's used to control the
routing engine. So any vehicle should allow to set and read it. */
if(attr->type == attr_profilename)
ret=1;
- if (ret == 1 && attr->type == attr_log_gpx_desc) {
- g_free(this_->gpx_desc);
- this_->gpx_desc = attr->u.str;
- }
if (ret == 1 && attr->type != attr_navit && attr->type != attr_pdl_gps_update)
this_->attrs=attr_generic_set_attr(this_->attrs, attr);
return ret != 0;