| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent def96ae commit 47b230a
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,7 +51,7 @@ function randomBytes(size, cb) { | |||
| 51 | 51 | ||
| 52 | 52 | const buf = Buffer.alloc(size); | |
| 53 | 53 | ||
| 54 | - if (!cb) return handleError(buf, 0, size); | ||
| 54 | + if (!cb) return handleError(_randomBytes(buf, 0, size), buf); | ||
| 55 | 55 | ||
| 56 | 56 | const wrap = new AsyncWrap(Providers.RANDOMBYTESREQUEST); | |
| 57 | 57 | wrap.ondone = (ex) => { // Retains buf while request is in flight. | |
@@ -77,7 +77,7 @@ function randomFillSync(buf, offset = 0, size) { | |||
| 77 | 77 | size = assertSize(size, elementSize, offset, buf.byteLength); | |
| 78 | 78 | } | |
| 79 | 79 | ||
| 80 | - return handleError(buf, offset, size); | ||
| 80 | + return handleError(_randomBytes(buf, offset, size), buf); | ||
| 81 | 81 | } | |
| 82 | 82 | ||
| 83 | 83 | function randomFill(buf, offset, size, cb) { | |
@@ -115,8 +115,7 @@ function randomFill(buf, offset, size, cb) { | |||
| 115 | 115 | _randomBytes(buf, offset, size, wrap); | |
| 116 | 116 | } | |
| 117 | 117 | ||
| 118 | - function handleError(buf, offset, size) { | ||
| 119 | - const ex = _randomBytes(buf, offset, size); | ||
| 118 | + function handleError(ex, buf) { | ||
| 120 | 119 | if (ex) throw ex; | |
| 121 | 120 | return buf; | |
| 122 | 121 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments