otsaloma / gaupol

Editor for text-based subtitle files
https://otsaloma.io/gaupol/
GNU General Public License v3.0
250 stars 35 forks source link

IndexError on preview #201

Closed casperdewith closed 1 year ago

casperdewith commented 1 year ago

I clicked on Tools › Preview and a dialog popped up. It said that I had to report the following information:


File: /usr/share/gaupol/gaupol/agents/preview.py
Line: 58
In: _on_preview_activate

    position = page.project.subtitles[row].start

IndexError: list index out of range

Environment

Platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Locale: en_GB.utf_8

Versions

aeidon: 1.10.1
chardet: 4.0.0
gaupol: 1.10.1
gspell: 1
gstreamer: 1.20.3.0
gtk+: 3.24.33
pygobject: 3.42.1
python: 3.10.6

Hope it helps.

otsaloma commented 1 year ago

Was this an with empty file, i.e. no subtitles at all?

casperdewith commented 1 year ago

Ooh, I don’t know. It could be. I was just starting and was checking out the functions.

In that case, adding a dialog would be useful: it could say that you need at least one line.


From: Osmo Salomaa @.> Sent: Sunday, January 15, 2023 12:37:05 AM To: otsaloma/gaupol @.> Cc: casperdewith @.>; Author @.> Subject: Re: [otsaloma/gaupol] Something went wrong when I clicked ‘preview’ (Issue #201)

Was this an with empty file, i.e. no subtitles at all?

— Reply to this email directly, view it on GitHubhttps://github.com/otsaloma/gaupol/issues/201#issuecomment-1382964482, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AILDOJCZN46TBCUWLC6S5P3WSM2CDANCNFSM6AAAAAAT3PT3D4. You are receiving this because you authored the thread.Message ID: @.***>

otsaloma commented 1 year ago

I was just checking since it sounds weird trying to preview nothing. By my reading of the code that's the case where this can happen. I'll fix it so that the menu item is grayed out if there are no subtitles.