Skip to content

Commit

Permalink
Update check conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
krishana7911 committed Jan 7, 2025
1 parent 11dee2f commit 68a86cb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/main/controllers/template/RTMediaTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,9 @@ public function add_hidden_fields_in_gallery() {
public function check_return_json() {
global $rtmedia_query;

/// Ensure the current action is 'upload' before proceeding.
if ( ! isset( $rtmedia_query )
|| ! isset( $rtmedia_query->action_query )
|| 'upload' !== $rtmedia_query->action_query->action ) {
return;
// Ensure $rtmedia_query and its nested format property are set before checking the value.
if ( isset( $rtmedia_query ) && isset( $rtmedia_query->format ) && 'json' === $rtmedia_query->format ) {
$this->json_output();
}
}

Expand Down

0 comments on commit 68a86cb

Please sign in to comment.