Fix one source of segfaults on shutdown in the linux binaries. Minor fixes.

This commit is contained in:
Kovid Goyal 2011-05-13 10:09:45 -06:00
parent 4af9c1340e
commit a070127d1d
3 changed files with 12 additions and 7 deletions

View File

@ -30,11 +30,12 @@ int report_libc_error(const char *msg) {
}
int pyobject_to_int(PyObject *res) {
int ret; PyObject *tmp;
int ret = 0; PyObject *tmp;
if (res != NULL) {
tmp = PyNumber_Int(res);
if (tmp == NULL) ret = (PyObject_IsTrue(res)) ? 1 : 0;
else ret = (int)PyInt_AS_LONG(tmp);
}
return ret;
}

View File

@ -191,7 +191,11 @@ class OEBReader(object):
if not scheme and href not in known:
new.add(href)
elif item.media_type in OEB_STYLES:
for url in cssutils.getUrls(item.data):
try:
urls = list(cssutils.getUrls(item.data))
except:
urls = []
for url in urls:
href, _ = urldefrag(url)
href = item.abshref(urlnormalize(href))
scheme = urlparse(href).scheme

View File

@ -53,7 +53,7 @@ class StoreAction(InterfaceAction):
if self.gui.current_view() is self.gui.library_view:
author = self.gui.library_view.model().authors(row)
if author:
author = author.replace('|', ',')
author = author.replace('|', ' ')
else:
mi = self.gui.current_view().model().get_book_display_info(row)
author = ' & '.join(mi.authors)