[TVAudio] Throw exception if 'setVolume' is called without argument
authorPiotr Czaja <p.czaja@samsung.com>
Tue, 17 Feb 2015 11:23:12 +0000 (12:23 +0100)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Wed, 18 Feb 2015 14:45:07 +0000 (23:45 +0900)
[Verification] 'setVolume' called without argument throws
InvalidValuesError.

Change-Id: I2f847be94a46342916cd3fb791b87f3882e98ca6
Signed-off-by: Piotr Czaja <p.czaja@samsung.com>
src/tvaudio/tvaudio_api.js

index 8613d67c3c570dd49e314ca660cb9fd555438b94..58a9ffc3abd516b633df088ce6e4110af2f75471 100644 (file)
@@ -83,6 +83,11 @@ AudioControlManager.prototype.setVolume = function(volume) {
         'Volume is out of range: ' + args.volume, 'InvalidValuesError');
   }
 
+  if (arguments.length < 1) {
+    throw new tizen.WebAPIException(tizen.WebAPIException.INVALID_VALUES_ERR,
+        'no volume argument: ' + arguments.length, 'InvalidValuesError');
+    }
+
   var ret = native.callSync('AudioControlManager_setVolume', {
     volume: args.volume
   });