Skip to content

Commit

Permalink
Another NullReferenceException quick fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Evengard committed Feb 14, 2023
1 parent ed61dc4 commit efd491c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plugins/mono/mono_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static MonoString *uwsgi_mono_method_GetUriPath(MonoObject *this) {
return uwsgi_mono_method_GetFilePathInt(this);
}

static MonoString *uwsgi_mono_method_MapPath(MonoObject *this, MonoString *virtualPath) {
static MonoString *uwsgi_mono_method_MapPathInt(MonoObject *this, MonoString *virtualPath) {
struct wsgi_request *wsgi_req = uwsgi_mono_get_current_req(this);
struct uwsgi_app *app = &uwsgi_apps[wsgi_req->app_id];
char *path = uwsgi_concat3n(app->interpreter, strlen(app->interpreter), "/", 1, mono_string_to_utf8(virtualPath), mono_string_length(virtualPath));
Expand Down Expand Up @@ -321,7 +321,7 @@ static void uwsgi_mono_add_internal_calls() {
mono_add_internal_call("uwsgi.uWSGIRequest::SendUnknownResponseHeader", uwsgi_mono_method_SendUnknownResponseHeader);
mono_add_internal_call("uwsgi.uWSGIRequest::FlushResponse", uwsgi_mono_method_FlushResponse);
mono_add_internal_call("uwsgi.uWSGIRequest::GetQueryString", uwsgi_mono_method_GetQueryString);
mono_add_internal_call("uwsgi.uWSGIRequest::MapPath", uwsgi_mono_method_MapPath);
mono_add_internal_call("uwsgi.uWSGIRequest::MapPathInt", uwsgi_mono_method_MapPathInt);
mono_add_internal_call("uwsgi.uWSGIRequest::GetHttpVerbName", uwsgi_mono_method_GetHttpVerbName);
mono_add_internal_call("uwsgi.uWSGIRequest::GetRawUrl", uwsgi_mono_method_GetRawUrl);
mono_add_internal_call("uwsgi.uWSGIRequest::GetFilePathInt", uwsgi_mono_method_GetFilePathInt);
Expand Down
12 changes: 11 additions & 1 deletion plugins/mono/uwsgi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,17 @@ public override string GetFilePath()
extern private string GetFilePathInt();

[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern public override string MapPath(string virtualPath);
extern private string MapPathInt(string virtualPath);

public override string MapPath(string virtualPath)
{
string mpath = MapPathInt(virtualPath)
if (mpath == null)
{
return GetFilePath();
}
return mpath;
}

public override void EndOfRequest() {
_requestEndEvent.Set();
Expand Down

0 comments on commit efd491c

Please sign in to comment.