Skip to content

Commit

Permalink
Fixed a few null ref bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
pbking committed Mar 22, 2024
1 parent 7235e27 commit c18c22c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions admin/create-theme/theme-create.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ public static function create_blank_theme( $theme, $screenshot ) {
}

private static function is_valid_screenshot( $file ) {
if ( ! $file ) {
return 0;
}
$filetype = wp_check_filetype( $file['name'], self::ALLOWED_SCREENSHOT_TYPES );
if ( is_uploaded_file( $file['tmp_name'] ) && in_array( $filetype['type'], self::ALLOWED_SCREENSHOT_TYPES, true ) && $file['size'] < 2097152 ) {
return 1;
Expand Down
2 changes: 1 addition & 1 deletion includes/class-create-block-theme-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ private function sanitize_theme_data( $theme ) {
$sanitized_theme['recommended_plugins'] = sanitize_textarea_field( $theme['recommended_plugins'] );
$sanitized_theme['template'] = '';
$sanitized_theme['slug'] = Theme_Utils::get_theme_slug( $theme['name'] );
$sanitized_theme['text_domain'] = $theme['slug'];
$sanitized_theme['text_domain'] = $sanitized_theme['slug'];
return $sanitized_theme;
}
}
1 change: 1 addition & 0 deletions tests/test-theme-fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ private function create_blank_theme() {
$request->set_param( 'author_uri', '' );
$request->set_param( 'tags_custom', '' );
$request->set_param( 'subfolder', '' );
$request->set_param( 'recommended_plugins', '' );

rest_do_request( $request );

Expand Down

0 comments on commit c18c22c

Please sign in to comment.