size() <= 0 and size() < 1.

This commit is contained in:
Yufeng Ying 2025-03-20 10:16:05 +08:00
parent 4f4031a675
commit 7a1a970c25
12 changed files with 16 additions and 16 deletions

View File

@ -533,7 +533,7 @@ void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) {
ERR_FAIL_COND(data.is_empty());
script_debugger->set_skip_breakpoints(data[0]);
} else if (command == "set_ignore_error_breaks") {
ERR_FAIL_COND(data.size() < 1);
ERR_FAIL_COND(data.is_empty());
script_debugger->set_ignore_error_breaks(data[0]);
} else if (command == "evaluate") {
String expression_str = data[0];
@ -675,7 +675,7 @@ Error RemoteDebugger::_core_capture(const String &p_cmd, const Array &p_data, bo
ERR_FAIL_COND_V(p_data.is_empty(), ERR_INVALID_DATA);
script_debugger->set_skip_breakpoints(p_data[0]);
} else if (p_cmd == "set_ignore_error_breaks") {
ERR_FAIL_COND_V(p_data.size() < 1, ERR_INVALID_DATA);
ERR_FAIL_COND_V(p_data.is_empty(), ERR_INVALID_DATA);
script_debugger->set_ignore_error_breaks(p_data[0]);
} else if (p_cmd == "break") {
script_debugger->debug(script_debugger->get_break_language());

View File

@ -410,7 +410,7 @@ String keycode_get_string(Key p_code) {
Key find_keycode(const String &p_codestr) {
Key keycode = Key::NONE;
Vector<String> code_parts = p_codestr.split("+");
if (code_parts.size() < 1) {
if (code_parts.is_empty()) {
return keycode;
}

View File

@ -1730,7 +1730,7 @@ void CodeTextEditor::toggle_bookmark() {
void CodeTextEditor::goto_next_bookmark() {
PackedInt32Array bmarks = text_editor->get_bookmarked_lines();
if (bmarks.size() <= 0) {
if (bmarks.is_empty()) {
return;
}
@ -1746,7 +1746,7 @@ void CodeTextEditor::goto_next_bookmark() {
void CodeTextEditor::goto_prev_bookmark() {
PackedInt32Array bmarks = text_editor->get_bookmarked_lines();
if (bmarks.size() <= 0) {
if (bmarks.is_empty()) {
return;
}

View File

@ -6063,7 +6063,7 @@ bool CanvasItemEditorViewport::_create_instance(Node *p_parent, const String &p_
}
void CanvasItemEditorViewport::_perform_drop_data() {
ERR_FAIL_COND(selected_files.size() <= 0);
ERR_FAIL_COND(selected_files.is_empty());
_remove_preview();

View File

@ -1696,7 +1696,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
} break;
case DEBUG_GOTO_NEXT_BREAKPOINT: {
PackedInt32Array bpoints = tx->get_breakpointed_lines();
if (bpoints.size() <= 0) {
if (bpoints.is_empty()) {
return;
}
@ -1711,7 +1711,7 @@ void ScriptTextEditor::_edit_option(int p_op) {
} break;
case DEBUG_GOTO_PREV_BREAKPOINT: {
PackedInt32Array bpoints = tx->get_breakpointed_lines();
if (bpoints.size() <= 0) {
if (bpoints.is_empty()) {
return;
}

View File

@ -302,7 +302,7 @@ void TileSetScenesCollectionSourceEditor::_update_tile_inspector() {
void TileSetScenesCollectionSourceEditor::_update_action_buttons() {
Vector<int> selected_indices = scene_tiles_list->get_selected_items();
scene_tile_delete_button->set_disabled(selected_indices.size() <= 0 || read_only);
scene_tile_delete_button->set_disabled(selected_indices.is_empty() || read_only);
}
void TileSetScenesCollectionSourceEditor::_update_scenes_list() {

View File

@ -2157,7 +2157,7 @@ void GDScriptAnalyzer::resolve_for(GDScriptParser::ForNode *p_for) {
GDScriptParser::IdentifierNode *callee = static_cast<GDScriptParser::IdentifierNode *>(call->callee);
if (callee->name == "range") {
list_resolved = true;
if (call->arguments.size() < 1) {
if (call->arguments.is_empty()) {
push_error(R"*(Invalid call for "range()" function. Expected at least 1 argument, none given.)*", call->callee);
} else if (call->arguments.size() > 3) {
push_error(vformat(R"*(Invalid call for "range()" function. Expected at most 3 arguments, %d given.)*", call->arguments.size()), call->callee);

View File

@ -249,7 +249,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
const Vector<String> link_target_parts = link_target.split(".");
if (link_target_parts.size() <= 0 || link_target_parts.size() > 2) {
if (link_target_parts.is_empty() || link_target_parts.size() > 2) {
ERR_PRINT("Invalid reference format: '" + tag + "'.");
output.append(tag);
@ -561,7 +561,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
const Vector<String> link_target_parts = link_target.split(".");
if (link_target_parts.size() <= 0 || link_target_parts.size() > 2) {
if (link_target_parts.is_empty() || link_target_parts.size() > 2) {
ERR_PRINT("Invalid reference format: '" + tag + "'.");
xml_output.append("<c>");

View File

@ -429,7 +429,7 @@ void ItemList::deselect(int p_idx) {
}
void ItemList::deselect_all() {
if (items.size() < 1) {
if (items.is_empty()) {
return;
}

View File

@ -5532,7 +5532,7 @@ void RichTextLabel::append_text(const String &p_bbcode) {
} else {
Vector<String> &expr = split_tag_block;
if (expr.size() < 1) {
if (expr.is_empty()) {
add_text("[");
pos = brk_pos + 1;
} else {

View File

@ -238,7 +238,7 @@ void SkeletonModification2DPhysicalBones::_update_simulation_state() {
}
_simulation_state_dirty = false;
if (_simulation_state_dirty_names.size() <= 0) {
if (_simulation_state_dirty_names.is_empty()) {
for (int i = 0; i < physical_bone_chain.size(); i++) {
PhysicalBone2D *physical_bone = Object::cast_to<PhysicalBone2D>(stack->skeleton->get_node(physical_bone_chain[i].physical_bone_node));
if (!physical_bone) {

View File

@ -2972,7 +2972,7 @@ void TextMesh::_generate_glyph_mesh_data(const GlyphMeshKey &p_key, const Glyph
PackedInt32Array contours = d["contours"];
bool orientation = d["orientation"];
if (points.size() < 3 || contours.size() < 1) {
if (points.size() < 3 || contours.is_empty()) {
return; // No full contours, only glyph control points (or nothing), ignore.
}