Skip to content

Commit

Permalink
Fix inspector sometimes saying end of file
Browse files Browse the repository at this point in the history
A check was setting 0 and null to NaN instead of just null

Fixes #232
Fixes #222
  • Loading branch information
Tyriar committed Mar 17, 2021
1 parent de58eae commit 113c580
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions media/data_inspector/byteData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT license.

interface ByteDataMessage {
decimal: number;
decimal: number | null;
adjacentBytes: ByteDataMessage[];
}

Expand All @@ -16,10 +16,10 @@ export class ByteData {
* @param message The message from the editor
*/
public static constructFromMessage(message: ByteDataMessage): ByteData {
// The message protocol converts NaN to Null so we convert it back here
const byteObj = new ByteData(message.decimal ? message.decimal : NaN);
// The message protocol converts NaN to null so we convert it back here
const byteObj = new ByteData(message.decimal !== null ? message.decimal : NaN);
for (const adjacentBytes of message.adjacentBytes) {
const current = new ByteData(adjacentBytes.decimal ? adjacentBytes.decimal : NaN);
const current = new ByteData(adjacentBytes.decimal !== null ? adjacentBytes.decimal : NaN);
byteObj.addAdjacentByte(current);
}
return byteObj;
Expand Down

0 comments on commit 113c580

Please sign in to comment.