Skip to content

fix: Fix null pointer exception#5113

Merged
liuruibin merged 2 commits into1Panel-dev:v2from
wangliang181230:PR/fix-problem-1
Apr 16, 2026
Merged

fix: Fix null pointer exception#5113
liuruibin merged 2 commits into1Panel-dev:v2from
wangliang181230:PR/fix-problem-1

Conversation

@wangliang181230
Copy link
Copy Markdown
Contributor

What this PR does / why we need it?

fix: Fix null pointer exception

Summary of your change

修复可能出现空指针异常的代码

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

@f2c-ci-robot
Copy link
Copy Markdown

f2c-ci-robot bot commented Apr 15, 2026

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link
Copy Markdown

f2c-ci-robot bot commented Apr 15, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

progress = 0
status = DownModelChunkStatus.pulling
if 'total' in row and 'completed' in row:
if 'total' in row and 'completed' in row and row.get('total'):
Copy link
Copy Markdown
Contributor Author

@wangliang181230 wangliang181230 Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

避免 除以0 的情况

if trigger_setting.get('token'):
token = request.META.get('HTTP_AUTHORIZATION')
if trigger_setting.get('token') != token.replace('Bearer ', ''):
if not token or trigger_setting.get('token') != token.replace('Bearer ', ''):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

避免 token.replace 报空指针异常

chat_record = QuerySet(ChatRecord).filter(id=chat_record_id, chat_id=chat_info.chat_id).first()
if chat_record is None:
if not is_valid_uuid(chat_record_id):
raise ChatException(500, _("Conversation record does not exist"))
Copy link
Copy Markdown
Contributor Author

@wangliang181230 wangliang181230 Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

避免 chat_info.chat_idchat_info is None 而报空指针异常

def tool_exec_record(self, tool_lib, all_params):
task_record_id = uuid.uuid7()
start_time = time.time()
filtered_args = all_params
Copy link
Copy Markdown
Contributor Author

@wangliang181230 wangliang181230 Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

避免 except 代码段中的 meta={'input': filtered_args, 'output': 'Error: ' + str(e)} 导致 meta.input 为空

elif type(v) == dict:
self.handle_variables(v)
if (type(v) == list) and (type(v[0]) == str):
elif (type(v) == list) and len(v) > 0 and type(v[0]) == str:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

避免 v[0] 报空指针

@liuruibin liuruibin merged commit fa58213 into 1Panel-dev:v2 Apr 16, 2026
1 of 2 checks passed
@wangliang181230 wangliang181230 deleted the PR/fix-problem-1 branch April 16, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants