Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
5d56b6ce
Commit
5d56b6ce
authored
Dec 17, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player_control: check if errored_song is set
getPlayerErrorStr() assumes that pc.errored_song is set when an error occured. Since the song may have been deleted meanwhile, add a NULL check.
parent
13192546
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
player_control.c
src/player_control.c
+14
-4
No files found.
src/player_control.c
View file @
5d56b6ce
...
...
@@ -148,12 +148,22 @@ enum player_error getPlayerError(void)
return
pc
.
error
;
}
static
const
char
*
pc_errored_song_uri
(
void
)
{
char
path_max_tmp
[
MPD_PATH_MAX
];
if
(
pc
.
errored_song
==
NULL
)
return
"?"
;
return
song_get_url
(
pc
.
errored_song
,
path_max_tmp
);
}
char
*
getPlayerErrorStr
(
void
)
{
/* static OK here, only one user in main task */
static
char
error
[
MPD_PATH_MAX
+
64
];
/* still too much */
static
const
size_t
errorlen
=
sizeof
(
error
);
char
path_max_tmp
[
MPD_PATH_MAX
];
*
error
=
'\0'
;
/* likely */
switch
(
pc
.
error
)
{
...
...
@@ -163,11 +173,11 @@ char *getPlayerErrorStr(void)
case
PLAYER_ERROR_FILENOTFOUND
:
snprintf
(
error
,
errorlen
,
"file
\"
%s
\"
does not exist or is inaccessible"
,
song_get_url
(
pc
.
errored_song
,
path_max_tmp
));
pc_errored_song_uri
(
));
break
;
case
PLAYER_ERROR_FILE
:
snprintf
(
error
,
errorlen
,
"problems decoding
\"
%s
\"
"
,
song_get_url
(
pc
.
errored_song
,
path_max_tmp
));
pc_errored_song_uri
(
));
break
;
case
PLAYER_ERROR_AUDIO
:
strcpy
(
error
,
"problems opening audio device"
);
...
...
@@ -177,7 +187,7 @@ char *getPlayerErrorStr(void)
break
;
case
PLAYER_ERROR_UNKTYPE
:
snprintf
(
error
,
errorlen
,
"file type of
\"
%s
\"
is unknown"
,
song_get_url
(
pc
.
errored_song
,
path_max_tmp
));
pc_errored_song_uri
(
));
}
return
*
error
?
error
:
NULL
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment