Skip to content

Commit efd491c

Browse files
committed
Another NullReferenceException quick fixup
1 parent ed61dc4 commit efd491c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

plugins/mono/mono_plugin.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static MonoString *uwsgi_mono_method_GetUriPath(MonoObject *this) {
163163
return uwsgi_mono_method_GetFilePathInt(this);
164164
}
165165

166-
static MonoString *uwsgi_mono_method_MapPath(MonoObject *this, MonoString *virtualPath) {
166+
static MonoString *uwsgi_mono_method_MapPathInt(MonoObject *this, MonoString *virtualPath) {
167167
struct wsgi_request *wsgi_req = uwsgi_mono_get_current_req(this);
168168
struct uwsgi_app *app = &uwsgi_apps[wsgi_req->app_id];
169169
char *path = uwsgi_concat3n(app->interpreter, strlen(app->interpreter), "/", 1, mono_string_to_utf8(virtualPath), mono_string_length(virtualPath));
@@ -321,7 +321,7 @@ static void uwsgi_mono_add_internal_calls() {
321321
mono_add_internal_call("uwsgi.uWSGIRequest::SendUnknownResponseHeader", uwsgi_mono_method_SendUnknownResponseHeader);
322322
mono_add_internal_call("uwsgi.uWSGIRequest::FlushResponse", uwsgi_mono_method_FlushResponse);
323323
mono_add_internal_call("uwsgi.uWSGIRequest::GetQueryString", uwsgi_mono_method_GetQueryString);
324-
mono_add_internal_call("uwsgi.uWSGIRequest::MapPath", uwsgi_mono_method_MapPath);
324+
mono_add_internal_call("uwsgi.uWSGIRequest::MapPathInt", uwsgi_mono_method_MapPathInt);
325325
mono_add_internal_call("uwsgi.uWSGIRequest::GetHttpVerbName", uwsgi_mono_method_GetHttpVerbName);
326326
mono_add_internal_call("uwsgi.uWSGIRequest::GetRawUrl", uwsgi_mono_method_GetRawUrl);
327327
mono_add_internal_call("uwsgi.uWSGIRequest::GetFilePathInt", uwsgi_mono_method_GetFilePathInt);

plugins/mono/uwsgi.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,17 @@ public override string GetFilePath()
104104
extern private string GetFilePathInt();
105105

106106
[MethodImplAttribute(MethodImplOptions.InternalCall)]
107-
extern public override string MapPath(string virtualPath);
107+
extern private string MapPathInt(string virtualPath);
108+
109+
public override string MapPath(string virtualPath)
110+
{
111+
string mpath = MapPathInt(virtualPath)
112+
if (mpath == null)
113+
{
114+
return GetFilePath();
115+
}
116+
return mpath;
117+
}
108118

109119
public override void EndOfRequest() {
110120
_requestEndEvent.Set();

0 commit comments

Comments
 (0)