mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-12-31 00:14:37 +02:00
Fix a bug where having multiple MIME types would crash GMenu2X
This commit is contained in:
parent
df981eb03a
commit
b8112d1a73
@ -163,13 +163,12 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
|||||||
#ifdef HAVE_LIBXDGMIME
|
#ifdef HAVE_LIBXDGMIME
|
||||||
param = opk_read_param(pdata, "MimeType");
|
param = opk_read_param(pdata, "MimeType");
|
||||||
if (param) {
|
if (param) {
|
||||||
string::size_type oldpos = 0;
|
|
||||||
string mimetypes = param;
|
string mimetypes = param;
|
||||||
|
|
||||||
while ((pos = mimetypes.find(';')) != mimetypes.npos) {
|
while ((pos = mimetypes.find(';')) != mimetypes.npos) {
|
||||||
int nb = 16;
|
int nb = 16;
|
||||||
char *extensions[nb];
|
char *extensions[nb];
|
||||||
string mimetype = mimetypes.substr(oldpos, pos);
|
string mimetype = mimetypes.substr(0, pos);
|
||||||
mimetypes = mimetypes.substr(pos + 1);
|
mimetypes = mimetypes.substr(pos + 1);
|
||||||
|
|
||||||
nb = xdg_mime_get_extensions_from_mime_type(
|
nb = xdg_mime_get_extensions_from_mime_type(
|
||||||
@ -179,8 +178,6 @@ LinkApp::LinkApp(GMenu2X *gmenu2x_, Touchscreen &ts, InputManager &inputMgr_,
|
|||||||
selectorfilter += (string) extensions[nb] + ',';
|
selectorfilter += (string) extensions[nb] + ',';
|
||||||
free(extensions[nb]);
|
free(extensions[nb]);
|
||||||
}
|
}
|
||||||
|
|
||||||
oldpos = pos + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove last comma */
|
/* Remove last comma */
|
||||||
|
Loading…
Reference in New Issue
Block a user