Skip to content

Commit

Permalink
Fix crash caused by null parameter passed to CameraServer.add_feed()
Browse files Browse the repository at this point in the history
Fixes #46181

CameraServer.add_feed() takes a CameraFeed object type as parameter.
Passing in another type of data while binding the method it will make
tha parameter null.
Added a check for null which returns from function and does not make the
engine crash anymore.
  • Loading branch information
lucicam committed Apr 2, 2021
1 parent 8610867 commit c158a63
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions servers/camera_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ Ref<CameraFeed> CameraServer::get_feed_by_id(int p_id) {
};

void CameraServer::add_feed(const Ref<CameraFeed> &p_feed) {
ERR_FAIL_COND(p_feed.is_null());

// add our feed
feeds.push_back(p_feed);

Expand Down

0 comments on commit c158a63

Please sign in to comment.