summaryrefslogtreecommitdiff
path: root/src/history.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/history.c')
-rw-r--r--src/history.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/history.c b/src/history.c
index 9f4e415b..ed8e6725 100644
--- a/src/history.c
+++ b/src/history.c
@@ -243,7 +243,7 @@ void add_History(iHistory *d, const iString *url ){
243 243
244iBool goBack_History(iHistory *d) { 244iBool goBack_History(iHistory *d) {
245 lock_Mutex(d->mtx); 245 lock_Mutex(d->mtx);
246 if (d->recentPos < size_Array(&d->recent) - 1) { 246 if (!isEmpty_Array(&d->recent) && d->recentPos < size_Array(&d->recent) - 1) {
247 d->recentPos++; 247 d->recentPos++;
248 postCommandf_Root(get_Root(), 248 postCommandf_Root(get_Root(),
249 "open history:1 scroll:%f url:%s", 249 "open history:1 scroll:%f url:%s",
@@ -279,7 +279,8 @@ iBool atLatest_History(const iHistory *d) {
279 279
280iBool atOldest_History(const iHistory *d) { 280iBool atOldest_History(const iHistory *d) {
281 iBool isOldest; 281 iBool isOldest;
282 iGuardMutex(d->mtx, isOldest = (d->recentPos == size_Array(&d->recent) - 1)); 282 iGuardMutex(d->mtx, isOldest = (isEmpty_Array(&d->recent) ||
283 d->recentPos == size_Array(&d->recent) - 1));
283 return isOldest; 284 return isOldest;
284} 285}
285 286