diff --git a/packages/x-data-grid/src/hooks/features/export/useGridPrintExport.tsx b/packages/x-data-grid/src/hooks/features/export/useGridPrintExport.tsx index 5ba08b587cdc5..7e609a5a18f15 100644 --- a/packages/x-data-grid/src/hooks/features/export/useGridPrintExport.tsx +++ b/packages/x-data-grid/src/hooks/features/export/useGridPrintExport.tsx @@ -183,9 +183,12 @@ export const useGridPrintExport = ( const gridFooterElement: HTMLElement | null = gridClone.querySelector( `.${gridClasses.footerContainer}`, ); - gridFooterElement!.style.position = 'absolute'; - gridFooterElement!.style.width = '100%'; - gridFooterElement!.style.top = `${computedTotalHeight - gridFooterElementHeight}px`; + + if (gridFooterElement) { + gridFooterElement!.style.position = 'absolute'; + gridFooterElement!.style.width = '100%'; + gridFooterElement!.style.top = `${computedTotalHeight - gridFooterElementHeight}px`; + } // printDoc.body.appendChild(gridClone); should be enough but a clone isolation bug in Safari // prevents us to do it