GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fs: add validateBuffer to improve error · nodejs/node@bb4891d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • fs.js
  • test/parallel
    • test-fs-read.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/fs.js‎

Copy file name to clipboardExpand all lines: lib/fs.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ function read(fd, buffer, offsetOrOptions, length, position, callback) {
632632
}
633633
({
634634
offset = 0,
635-
length = buffer.byteLength - offset,
635+
length = buffer?.byteLength - offset,
636636
position = null,
637637
} = params ?? kEmptyObject);
638638
}
Collapse file

‎test/parallel/test-fs-read.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-read.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ assert.throws(
7979

8080
assert.throws(
8181
() => fs.read(fd, { buffer: null }, common.mustNotCall()),
82-
/TypeError: Cannot read properties of null \(reading 'byteLength'\)/,
82+
{ code: 'ERR_INVALID_ARG_TYPE' },
8383
'throws when options.buffer is null'
8484
);
8585

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.