Skip to content

Commit

Permalink
Fix details panel from showing the wrong pieces
Browse files Browse the repository at this point in the history
  • Loading branch information
egbertbouman committed Feb 13, 2025
1 parent 71b4bcf commit 765f5d9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tribler/ui/src/pages/Downloads/Pieces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ export default function Pieces({ pieces64, numpieces }: { pieces64: string, nump
if (ref.current) {
const canvas = ref.current.getContext('2d');
const pieces = convertPieces(pieces64, numpieces);
if (!canvas || !pieces || pieces.length === 0) { return; }
if (!canvas) { return; }

// Get size from the HTML canvas element
const width = canvas.canvas.width;
const height = canvas.canvas.height;
const numPieces = numpieces;
if (!pieces || pieces.length === 0) { return canvas.clearRect(0, 0, width, height); }

if (numPieces <= width) {
const pieceWidth = width / numPieces;
Expand Down

0 comments on commit 765f5d9

Please sign in to comment.