[vlc-commits] test.html: check validity of text field values
Daniel Amm
git at videolan.org
Sun Jun 14 00:58:27 CEST 2015
npapi-vlc | branch: master | Daniel Amm <da2424 at t-online.de> | Sun Jun 14 00:35:47 2015 +0200| [3f3a17578d6f789b6092bfcd3040995592703189] | committer: Jean-Baptiste Kempf
test.html: check validity of text field values
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=3f3a17578d6f789b6092bfcd3040995592703189
---
share/test/test.html | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/share/test/test.html b/share/test/test.html
index b53666d..6aee558 100644
--- a/share/test/test.html
+++ b/share/test/test.html
@@ -514,7 +514,11 @@ function doAudioTrack(value)
var vlc = getVLC("vlc");
if( vlc )
{
- vlc.audio.track = vlc.audio.track + value;
+ var newValue = vlc.audio.track + value;
+ if( newValue >= 0 && newValue < vlc.audio.count )
+ {
+ vlc.audio.track = newValue;
+ }
document.getElementById("trackTextField").innerHTML = vlc.audio.track;
}
}
@@ -531,7 +535,11 @@ function doSubtitle(value)
var vlc = getVLC("vlc");
if( vlc )
{
- vlc.subtitle.track = vlc.subtitle.track + value;
+ var newValue = vlc.subtitle.track + value;
+ if( newValue >= 0 && newValue < vlc.subtitle.count )
+ {
+ vlc.subtitle.track = vlc.subtitle.track + value;
+ }
document.getElementById("spuTextField").innerHTML = vlc.subtitle.track;
}
}
@@ -577,7 +585,14 @@ function doRemoveItem(item)
{
var vlc = getVLC("vlc");
if( vlc )
- vlc.playlist.items.remove(item);
+ {
+ var count = vlc.playlist.items.count;
+ if( !isNaN(item) && item !== "" && item >= 0 && item < count )
+ {
+ vlc.playlist.items.remove(item);
+ doItemCount();
+ }
+ }
}
function doPlaylistClearAll()
More information about the vlc-commits
mailing list