Merge pull request #12752 from inietov/fixes/attempt_to_read_property_on_null

Fixed ErrorException: Attempt to read property "rtd_location_id" on null [sc-20562]
This commit is contained in:
snipe 2023-03-28 16:32:34 -07:00 committed by GitHub
commit b57b5e23d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -832,7 +832,6 @@ class AssetsController extends Controller
} elseif (request('checkout_to_type') == 'asset') {
$target = Asset::where('id', '!=', $asset_id)->find(request('assigned_asset'));
$asset->location_id = $target->rtd_location_id;
// Override with the asset's location_id if it has one
$asset->location_id = (($target) && (isset($target->location_id))) ? $target->location_id : '';
$error_payload['target_id'] = $request->input('assigned_asset');