浏览代码

Fix crash caused by null parameter passed to CameraServer.add_feed()

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.
lucicam 4 年之前
父节点
当前提交
c158a63a8a
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      servers/camera_server.cpp

+ 2 - 0
servers/camera_server.cpp

@@ -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);