[vlc-devel] [PATCH 11/17] test.html: check validity of text field values
Daniel Amm
da2424 at t-online.de
Sun Jun 14 00:35:47 CEST 2015
---
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 100755
--- 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()
--
2.1.4
More information about the vlc-devel
mailing list