Better index boundary check for prompt.
Signed-off-by: Arun Prakash Jana <engineerarun@gmail.com>
This commit is contained in:
parent
2708e70004
commit
321c550f1a
8
buku
8
buku
@ -109,8 +109,6 @@ def usage():
|
|||||||
|
|
||||||
# Get page response data
|
# Get page response data
|
||||||
def getPageResp(url, redir=False):
|
def getPageResp(url, redir=False):
|
||||||
marker = -1
|
|
||||||
|
|
||||||
if url.find("https://") >= 0: # Secure connection
|
if url.find("https://") >= 0: # Secure connection
|
||||||
server = url[8:]
|
server = url[8:]
|
||||||
marker = server.find("/")
|
marker = server.find("/")
|
||||||
@ -334,15 +332,15 @@ def searchdb(cur, keywords):
|
|||||||
|
|
||||||
if is_int(nav):
|
if is_int(nav):
|
||||||
index = int(nav) - 1
|
index = int(nav) - 1
|
||||||
if index < 0:
|
if index < 0 or index >= count:
|
||||||
print("Index out of bound")
|
print("Index out of bound")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
openurl = unquote(results[int(nav) - 1])
|
openurl = unquote(results[int(nav) - 1])
|
||||||
browser_open(openurl)
|
browser_open(openurl)
|
||||||
except IndexError:
|
except Exception as e:
|
||||||
print("Index out of bound")
|
print("Exception: %s" % e)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user