void a_settings_set_integer_list_containing ( const gchar *name, gint val )
{
gint* vals = NULL;
- gsize length;
+ gsize length = 0;
gboolean need_to_add = TRUE;
gint ii = 0;
// Get current list
if ( a_settings_get_integer_list ( name, &vals, &length ) ) {
// See if it's not already there
- if ( vals && length ) {
+ if ( vals ) {
while ( ii < length ) {
if ( vals[ii] == val ) {
need_to_add = FALSE;
}
}
// Add value into array if necessary
- if ( need_to_add ) {
+ if ( vals && need_to_add ) {
// NB not bothering to sort this 'list' ATM as there is not much to be gained
guint new_length = length + 1;
gint new_vals[new_length];
rv.s = "";
set = TRUE;
}
- else if ( is_file_operation ) {
+ else if ( is_file_operation && vml->cache_dir ) {
if ( a_vik_get_file_ref_format() == VIK_FILE_REF_FORMAT_RELATIVE ) {
gchar *cwd = g_get_current_dir();
if ( cwd ) {
rv.s = file_GetRelativeFilename ( cwd, vml->cache_dir );
if ( !rv.s ) rv.s = "";
set = TRUE;
- }
- }
+ }
+ }
}
if ( !set )
rv.s = vml->cache_dir ? vml->cache_dir : "";
GInputStream *stream = g_memory_input_stream_new_from_data ( data, bytes, NULL );
GError *error = NULL;
pixbuf = gdk_pixbuf_new_from_stream ( stream, NULL, &error );
- if (error || (!pixbuf)) {
+ if ( error ) {
g_warning ( "%s: %s", __FUNCTION__, error->message );
g_error_free ( error );
}
}
case 'N': // Name of track
- values[i] = g_strdup_printf ( _("%sTrack: %s"), separator, trk->name );
+ if ( trk )
+ values[i] = g_strdup_printf ( _("%sTrack: %s"), separator, trk->name );
break;
case 'E': // Name of trackpoint if available