diff --git a/lib/resource/lock/Lock.js b/lib/resource/lock/Lock.js index fe811512..c54c6374 100644 --- a/lib/resource/lock/Lock.js +++ b/lib/resource/lock/Lock.js @@ -12,6 +12,8 @@ var Lock = (function () { var rnd1 = Math.ceil(Math.random() * 0x3FFF) + 0x8000; var rnd2 = Math.ceil(Math.random() * 0xFFFFFFFF); function pad(value, nb) { + if (value < 0) + value *= -1; var str = Math.ceil(value).toString(16); while (str.length < nb) str = '0' + str; diff --git a/src/resource/lock/Lock.ts b/src/resource/lock/Lock.ts index df3512e1..21aa1879 100644 --- a/src/resource/lock/Lock.ts +++ b/src/resource/lock/Lock.ts @@ -13,6 +13,9 @@ export class Lock function pad(value : number, nb : number) { + if(value < 0) + value *= -1; + let str = Math.ceil(value).toString(16); while(str.length < nb) str = '0' + str;